try {
    (function (window) {
        function Util() {}
        Util.dom = function (obj) {
            var o = document.getElementsByTagName('*');
            var i = o.length;
            while (i--) o[i].id ? this[o[i].id] = o[i] : this[o[i].tagName] = o[i];
            return this;
        };
        Util.searchArray = function (str, arr) {
            var i = arr.length;
            var bool = false;
            while (i--) {
                if (str == arr[i]) {
                    bool = true;
                    break;
                }
            }
            return bool;
        };
        Util.findClass = function (o, clss) {
            return new RegExp('(^|\\s)' + clss + '(\\s|$)').test(o.className);
        };
        Util.hexToRGB = function (hex) {
            var rgb = new Array();
            hex = (hex.charAt(0) == "#") ? hex.substring(1, 7) : hex;
            rgb['r'] = parseInt(hex.substring(0, 2), 16);
            rgb['g'] = parseInt(hex.substring(2, 4), 16);
            rgb['b'] = parseInt(hex.substring(4, 6), 16);
            return rgb;
        };
        Util.percentToPixels = function (value, range) {
            if (value.search('%') > -1) {
                value = value.replace('%', '');
                value = (Number(value) * .01) * range;
                return Math.round(value);
            } else if (value.search('px') > -1) {
                value = value.replace('px', '');
                return Number(value);
            } else {
                return Number(value);
            }
        };
        Util.getStyle = function (obj, prop) {
            try {
                return parseInt(window.getComputedStyle(obj).getPropertyValue(prop));
            } catch (e) { /*console.log(obj,prop)*/ };
        };
        Util.getDocHeight = function () {
            return Math.max(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.documentElement.offsetHeight), Math.max(document.body.clientHeight, document.documentElement.clientHeight));
        };
        Util.getExt = function (file) {
            return file.split('.').pop();
        };
        Util.getThumbQuery = function (w, h) {
            if (RETINA) {
                return '?w=' + w * 2 + '&h=' + h * 2 + '&f=';
            } else {
                return '?w=' + w + '&h=' + h + '&f=';
            }
        };
        window.Util = Util;
    }(window));

    function closeBlocker() {
        var blocker = document.getElementById('blocker');
        if (blocker) {
            new CSSTween(blocker, [0], ['opacity .25s ease-in-out'], function () {
                Site.blocker = false;
                document.body.removeChild(blocker);
            }, false);
        }
    }

    function showBlocker() {
        Site.blocker = true;
        var blocker = document.getElementById('blocker');
        if (!blocker) blocker = document.createElement('div');
        blocker.setAttribute('id', 'blocker');
        blocker.style.position = 'absolute';
        blocker.style.width = '100%';
        if (POD) {
            blocker.style.height = window.innerHeight + 'px';
            blocker.style.top = window.pageYOffset + 'px';
        } else {
            blocker.style.height = '100%';
            blocker.style.top = 0 + 'px';
        }
        blocker.style.zIndex = 3;
        blocker.style.left = 0 + 'px';
        blocker.style.backgroundColor = "rgba(0,0,0,0.65)";
        document.body.appendChild(blocker);
        blocker.style.opacity = 0;
        blocker.style.zIndex = 10;
        new CSSTween(blocker, [1], ['opacity .25s ease-in-out'], '', false);
    }

    function resizeBlocker() {
        var blocker = document.getElementById('blocker');
        if (blocker) {
            blocker.style.left = 0 + 'px';
            blocker.style.top = 0 + 'px';
            if (POD) {
                blocker.style.height = window.innerHeight + 'px';
                blocker.style.top = window.pageYOffset + 'px';
            }
        }
    }

    function trace(value) {
        console.log(value);
    }
    var USER_AGENT = 'html',
        BROWSER_NAME = 'Chrome',
        BROWSER_VERSION = '24.0.1312.57',
        PAD = 'html' === 'pad' ? true : false,
        POD = 'html' === 'pod' ? true : false,
        Firefox = navigator.userAgent.match(/Firefox/i) != null,
        Opera = navigator.userAgent.match(/Opera/i) != null,
        Safari = navigator.userAgent.match(/Safari/i) != null,
        mSafari = navigator.userAgent.match(/(Mobile).+(Safari)/i) != null,
        IOS4 = navigator.userAgent.match(/(iPhone).+(OS 4)/i) != null,
        DROID = navigator.userAgent.match(/Android/i) != null && navigator.userAgent.match(/Pad/i) != 'Pad',
        Chrome = navigator.userAgent.match(/Chrome/i) != null,
        RETINA = (window.retina || window.devicePixelRatio > 1),
        d = Util.dom(),
        STAGE_WIDTH = 0,
        STAGE_HEIGHT = 0,
        easeOut = 'cubic-bezier(0,0,0.25,1)',
        INTRO = 'intro',
        HOME = 'home',
        SLIDESHOW = 'rootSlideshow',
        IMAGE = 'image',
        VIDEO = 'video',
        HTML = 'html',
        SWF = 'swf',
        LINK = 'link',
        PDF = 'pdf',
        CONTACT = 'contactForm',
        SLIDE_INTERVAL = 5 * 1000,
        TOUCH_START = 'touchstart',
        TOUCH_MOVE = 'touchmove',
        TOUCH_END = 'touchend',
        TOUCH_CANCEL = 'touchcancel',
        MOUSE_OVER = 'mouseover',
        MOUSE_DOWN = 'mousedown',
        MOUSE_MOVE = 'mousemove',
        MOUSE_UP = 'mouseup',
        MOUSE_OUT = 'mouseout',
        CLICK = 'click';
    "ontouchstart" in window ? touchDevice = true : touchDevice = false;
    var SELECT_EVENT = touchDevice ? 'touchend' : 'click';
    var Address = {
        path: '',
        pathNames: [],
        listeners: [],
        firstload: true,
        docTitle: document.title || '',
        base: '/',
        ga: false,
        addEventListener: function (type, callback) {
            if (window.history.pushState && window.location.hash) {
                this.removeHash(window.location.hash);
            } else if (!window.history.pushState) {
                this.addHash();
            }
            if (window.location.href.search("%20") > -1 || window.location.href.search(" ") > -1) {
                this.addDashes();
            }
            this.listeners.push({
                'type': type,
                'listener': callback
            });
            this.setListeners();
        },
        setListeners: function () {
            if (window.attachEvent) {
                this.savedHash = window.location.hash;
                setInterval(this.checkHash, 200);
            } else {
                window.onpopstate = window.onhashchange = function () {
                    Address.fireListeners();
                }
            }
        },
        fireListeners: function () {
            if (!this.firstload) {
                this.path = this.getPath();
                this.pathNames = this.getPathNames();
                for (var i in this.listeners) {
                    var fn = this.listeners[i].listener;
                    if (typeof fn === 'function') {
                        fn(this.path);
                    } else {
                        var ns = fn.split('.');
                        window.document[ns[0]][ns[1]](this.path);
                    }
                }
            }
        },
        setValue: function (value) {
            this.firstload = false;
            this.value = value = this.trim(value) === '' ? '' : value = this.trim(value) + '/';
            if (value.indexOf("http") == 0) {
                window.location = value;
            } else if (window.history.pushState) {
                window.history.pushState({
                    value: this.base + value
                }, '', this.base + value);
                this.fireListeners();
            } else {
                window.location = this.base + '#/' + value;
            }
            if (this.ga) _gaq.push(['_trackPageview']);
        },
        setPath: function (value) {
            this.setValue(value);
        },
        back: function () {
            history.back();
        },
        setLocation: function (value) {
            window.location = value;
        },
        getBase: function () {
            return this.base;
        },
        getPath: function () {
            if (!window.history.state && this.value) {
                return decodeURIComponent(this.trim(this.value));
            } else if (window.location.hash) {
                return decodeURIComponent(this.trim(window.location.hash));
            } else {
                return decodeURIComponent(this.trim(window.location.pathname));
            }
        },
        getQuery: function () {
            return window.location.search;
        },
        getPathNames: function () {
            return this.getPath().split('/');
        },
        setTitle: function (title) {
            document.title = this.docTitle = title;
        },
        getTitle: function () {
            return this.docTitle ? this.docTitle : document.title;
        },
        addHash: function () {
            window.location = this.base + '#/' + this.trim(this.getPath());
        },
        removeHash: function (hash) {
            window.location = this.base + this.trim(hash);
        },
        getHost: function () {
            return window.location.host;
        },
        addDashes: function () {
            var str = window.location.href.replace(/ /g, '-');
            window.location = str.replace(/%20/g, '-');
        },
        trim: function (str) {
            if (this.base !== '/') str = str.replace(this.base, '');
            return str.replace(/^#/, '').replace(/^\s+|\s+$/g, '').replace(/^\/|\/$/g, '');
        },
        checkHash: function () {
            if (Address.savedHash !== window.location.hash) {
                Address.savedHash = window.location.hash;
                Address.fireListeners();
            }
        }
    };
    (function (window) {
        CSSTween.vendors = ['WebkitTransition', 'MozTransition', 'OTransition', 'transition'];
        CSSTween.cubic = 'cubic-bezier(0.770,0.000,0.175,1.000)';

        function CSSTween(obj, to, atr, callback, rmHA) {
            var dur = atr[0].split(' ')[1];
            obj.dur = dur[dur.length - 2] === 'ms' ? Number(dur.replace(dur[dur.length - 2], '')) : Number(dur.replace(dur[dur.length - 1], '')) * 1000;
            obj.atr = atr[0].split(' ')[0];
            obj.cb = callback || false;
            this.obj = obj;
            obj.rmHA = rmHA || false;
            if (obj.style) CSSTween.checkDisplay(obj);
            if (!rmHA && (Safari || mSafari)) obj.style.WebkitTransform = 'translateZ(0)';
            CSSTween.setAttributes(obj, atr);
            setTimeout(function () {
                CSSTween.initTween(obj, to, atr);
                CSSTween.setEndHandlers(obj);
            }, 1);
        }
        CSSTween.setAttributes = function (obj, atr) {
            var i = CSSTween.vendors.length;
            while (i--) obj.style[CSSTween.vendors[i]] = CSSTween.replaceEasingCurves(atr.toString());
        };
        CSSTween.initTween = function (obj, to, atr) {
            var i = to.length;
            while (i--) obj.style[atr[i].split(' ')[0]] = to[i];
        };
        CSSTween.setEndHandlers = function (obj) {
            setTimeout(function () {
                CSSTween.onComplete(obj);
            }, obj.dur);
        };
        CSSTween.onComplete = function (obj) {
            if (obj.cb) obj.cb(obj);
            if (obj.style && obj.atr === 'opacity' && obj.style.opacity === 0) {
                obj.style.display = 'none';
            }
            if (obj.rmHA && (Safari || mSafari)) obj.style.WebkitTransform = 'none';
        };
        CSSTween.checkDisplay = function (obj) {
            if (obj.atr === 'opacity' && obj.style.display === 'none') {
                obj.style.display = 'block';
                obj.style.opacity = 0;
            }
        };
        CSSTween.replaceEasingCurves = function (str) {
            return str.replace(/cubic/g, CSSTween.cubic);
        };
        window.CSSTween = CSSTween;
    }(window));
    (function (window) {
        Menu.closeDelay = 3000;
        Menu.subs = [];
        Menu.expandAll = true;
        Menu.state = 'open';
        Menu.bulletWidth = 0;
        Menu.bulletHeight = 0;
        Menu.bulletSubWidth = 0;
        Menu.bulletSubHeight = 0;

        function Menu() {
            Menu.load();
        }
        Menu.load = function () {
            d.menuText.style.opacity = 0;
            var menuBgAlpha = 1 < .90 ? .90 : 1;
            var topMenuPad = 0,
                bottomMenuPad = 0;
            if (!POD) {
                if ('top' == 'top' && !POD) {
                    topMenuPad = 10;
                    bottomMenuPad = 0;
                } else if ('top' == 'center' && !POD) {
                    topMenuPad = 10 * 0.5;
                    bottomMenuPad = 10 * 0.5;
                } else if ('top' == 'bottom' && !POD) {
                    topMenuPad = 0;
                    bottomMenuPad = 10;
                }
            }
            if (POD) {
                var logoBgRgb = Util.hexToRGB('#ffffff');
                d.logo.style.backgroundColor = "rgba(" + logoBgRgb.r + "," + logoBgRgb.g + "," + logoBgRgb.b + "," + menuBgAlpha + ")";
                var menuRgb = Util.hexToRGB('#ffffff');
                d.menuText.style.backgroundColor = "rgba(" + menuRgb.r + "," + menuRgb.g + "," + menuRgb.b + "," + menuBgAlpha + ")";
                d.menuText.style.top = 0 + 'px';
            } else if (PAD) {
                var menuRgb = Util.hexToRGB('#ffffff');
                d.logo.style.backgroundColor = "rgba(" + menuRgb.r + "," + menuRgb.g + "," + menuRgb.b + "," + menuBgAlpha + ")";
                d.menu.style.backgroundColor = "rgba(" + menuRgb.r + "," + menuRgb.g + "," + menuRgb.b + "," + menuBgAlpha + ")";
            }
            Menu.getBulletWidth();
            if (PAD || POD) {
                Menu.buttonBuild();
            }
            if (POD) document.addEventListener("scroll", Menu.buttonPos, false);
            Menu.resize();
            Site.resize();
            new CSSTween(d.menuText, [1], ['opacity .3s linear']);
            if (!Menu.expandAll && !POD) {
                Menu.getSubMenus();
                Menu.collapseAll();
            }
            var scrollBarWidth = PAD ? 10 : 6;
            if (!POD) {
                if (!Menu.scroll) Menu.scroll = new Scroll(d.menuText, d.menuMask, {
                        width: scrollBarWidth,
                        align: 'left',
                        vAlign: 'top',
                        topPad: 0,
                        bottomPad: 0,
                        color: '#757575',
                        hover: '#ff0000',
                        name: 'menu'
                    });
            }
            Menu.mouseEvents();
            if ('file' === 'file' && PAD) {
                Menu.alignLogo();
            }
        };
        Menu.alignLogo = function () {
            var logoImg = d.logo.getElementsByTagName('img')[0];
            logoImg.style.paddingTop = 30 + 'px';
            var retinaSizedLogo = (logoImg.getAttribute('src').search('@2x') > -1);
            if (PAD && logoImg.width < 275 && !retinaSizedLogo) {
                logoImg.style.paddingLeft = ((275 - logoImg.width) * 0.5) + 'px';
            } else if (PAD && (logoImg.width * 0.5) < 275 && retinaSizedLogo) {
                logoImg.style.paddingLeft = ((275 - logoImg.width) * 0.5) + 'px';
            }
        };
        Menu.resize = function () {
            if (!POD && !PAD) d.menu.style.top = 50 + 30 + 'px';
            var menuHeight;
            if (PAD) {
                var logoHeight = Util.getStyle(d.logo, 'height');
                menuHeight = STAGE_HEIGHT - logoHeight;
                d.menu.style.top = logoHeight + 'px';
                d.logo.style.top = -logoHeight + 'px';
            } else {
                menuHeight = (window.innerHeight - (50 + 100));
            }
            if (!POD) new CSSTween(d.menu, [menuHeight + 'px'], ['height 0s linear']);
            if (!POD && !PAD) {
                new CSSTween(d.menuBg, [menuHeight + 'px'], ['height 0s linear']);
                switch ('left') {
                    case 'left':
                        d.menu.style.left = 60 + 'px';
                        d.menuBg.style.left = 60 + 'px';
                        break;
                    case 'right':
                        d.menu.style.right = 25 + 'px';
                        d.menuBg.style.right = 25 + 'px';
                        break;
                }
            }
            if (POD || PAD) Menu.buttonPos();
            if ('left' == 'center' && !POD) {
                var menuTextWidth = Util.getStyle(d.menuText, 'width');
                d.menuText.style.left = (((275 - menuTextWidth) * 0.5)) + 'px';
            } else if ('left' == 'left' && !POD) {
                var menuTextWidth = Util.getStyle(d.menuText, 'width');
                d.menuText.style.left = (25) + 'px';
            }
            var footerHeight = document.getElementsByTagName('footer')[0] ? Util.getStyle(document.getElementsByTagName('footer')[0], 'height') : 0;
            if ('top' == 'top' && !POD && PAD) {
                if ('top' == 'top' && 'left' == 'left') {
                    var top = 10 - logoHeight;
                    if (top > 0) {
                        d.menuMask.style.top = top + 'px';
                    } else {
                        d.menuMask.style.top = 0 + 'px';
                    }
                } else {
                    d.menuMask.style.top = 10 + 'px';
                }
                d.menuText.style.top = 0 + 'px';
            } else if ('top' == 'top' && !POD) {
                d.menuMask.style.top = '10px';
                d.menuText.style.top = 0 + 'px';
            } else if ('top' == 'center' && !POD && PAD) {
                var menuTextHeight = Util.getStyle(d.menuText, 'height');
                var center = (menuHeight - (menuTextHeight + logoHeight)) * 0.5;
                if (center > 0) {
                    d.menuMask.style.top = center + 'px';
                } else {
                    d.menuMask.style.top = 0 + 'px';
                }
                d.menuText.style.top = 0 + 'px';
            } else if ('top' == 'center' && !POD) {
                var menuTextHeight = Util.getStyle(d.menuText, 'height');
                d.menuMask.style.top = ((menuHeight - menuTextHeight) * 0.5) + 'px';
                d.menuText.style.top = 0 + 'px';
            } else if ('top' == 'bottom' && !POD && PAD) {
                d.menuMask.style.bottom = 10 + footerHeight + 10 + 'px';
                d.menuText.style.bottom = 0 + 'px';
            } else if ('top' == 'bottom' && !POD) {
                d.menuMask.style.bottom = '10px';
                d.menuText.style.bottom = 0 + 'px';
            }
            if (!POD) {
                var menuTextHeight = Util.getStyle(d.menuText, 'height');
                var menuTextPaddingVertical = PAD ? logoHeight + 10 + footerHeight + 10 : 10;
                if (('top' == 'top' || 'top' == 'bottom') && STAGE_HEIGHT - menuTextPaddingVertical < menuTextHeight) {
                    d.menuMask.style.height = STAGE_HEIGHT - menuTextPaddingVertical + 'px';
                } else if ('top' == 'center' && STAGE_HEIGHT < menuTextHeight) {
                    d.menuMask.style.top = 0 + 'px';
                    d.menuMask.style.height = STAGE_HEIGHT + 'px';
                } else {
                    d.menuMask.style.height = menuTextHeight + 'px';
                }
                Scroll.resize();
            }
            if (POD && Menu.state == 'closed') {
                var closedX = -(Menu.getWidth());
                new CSSTween(d.menu, [closedX + 'px'], ['left 0s']);
                new CSSTween(d.logo, [0], ['opacity 0s']);
                Menu.buttonPos();
                Menu.buttonShow();
            } else if (PAD && Menu.state == 'closed') {
                Menu.buttonPos();
                Menu.buttonShow();
            }
        };
        Menu.getSubMenus = function () {
            var divs = d.menuText.getElementsByTagName('div');
            for (var i in divs) {
                if (Util.findClass(divs[i], 'subMenu')) {
                    Menu.subs.push(divs[i]);
                }
            }
        };
        Menu.expand = function (id) { /*d.menuMask.style.overflow='visible';*/
            for (var i in Menu.subs) {
                var sub = Menu.subs[i];
                if (sub.getAttribute('data-id') == id) {
                    sub.setAttribute('data-collapse', false);
                    var height = Number(sub.getAttribute('data-height'));
                    sub.style.display = 'block';
                    new CSSTween(sub, [height + 'px', 1], ['height .25s', 'opacity .35s'], function () {
                        this.style.overflow = 'visible';
                        Menu.resize();
                        Scroll.resize();
                        setTimeout(Menu.resize, 500);
                    });
                } else if (!Menu.expandAll && !POD) {
                    sub.setAttribute('data-collapse', true);
                    sub.style.overflow = 'hidden';
                    new CSSTween(sub, [0 + 'px', 0], ['height .25s', 'opacity .25s'], function () {
                        this.style.display = 'none';
                        Menu.resize();
                    });
                }
            }
        };
        Menu.collapseAll = function () {
            for (var i in Menu.subs) {
                var sub = Menu.subs[i];
                sub.setAttribute('data-height', Util.getStyle(sub, 'height'));
                sub.setAttribute('data-collapse', true);
                sub.style.height = 0 + 'px';
                sub.style.opacity = 0;
                sub.style.display = 'none';
                sub.style.overflow = 'hidden';
            }
        };
        Menu.getWidth = function () {
            if (POD) {
                return window.innerWidth;
            } else if (PAD) {
                return 275;
            } else {
                return 275;
            }
        };
        Menu.getLeft = function () {
            if (PAD || POD) {
                Menu.left = 0;
            } else {
                Menu.left = 'left' == 'left' ? Menu.getWidth() + 60 : 60;
            }
            return Menu.left;
        };
        Menu.buttonBuild = function () {
            Menu.menuBtn = document.createElement('img');
            Menu.menuBtn.style.opacity = 0;
            Menu.menuBtn.style.position = 'absolute';
            var src = RETINA ? 'menu@2x.png' : 'menu.png';
            Menu.menuBtn.setAttribute('src', Address.base + 'inc/icn/' + src);
            Menu.menuBtn.style.display = 'block';
            Menu.menuBtn.style.zIndex = 40;
            Menu.menuBtn.style.width = 20 + 'px';
            Menu.menuBtn.style.height = 20 + 'px';
            d.site.appendChild(Menu.menuBtn);
            Menu.buttonPos();
        };
        Menu.buttonShow = function () {
            new CSSTween(Menu.menuBtn, [.65], ['opacity .3s']);
            Menu.menuBtn.addEventListener('click', Menu.open, false);
        };
        Menu.buttonHide = function () {
            new CSSTween(Menu.menuBtn, [0], ['opacity .3s']);
            Menu.menuBtn.removeEventListener('click', Menu.open, false);
        };
        Menu.buttonPos = function () {
            new CSSTween(Menu.menuBtn, [5 + 'px', window.pageYOffset + 5 + 'px'], ['left .1s linear', 'top .1s linear']);
        };
        Menu.open = function () {
            Menu.state = 'open';
            if (Menu.closeTimer) clearTimeout(Menu.closeTimer);
            var openX = 0 + 'px';
            d.menu.style.display = 'block';
            Menu.buttonPos();
            Menu.buttonHide();
            new CSSTween(d.logo, [1], ['opacity .2s']);
            new CSSTween(d.menu, [1, openX], ['opacity .35s', 'left .5s']);
            if (Menu.scroll) Menu.scroll.back.style.visibility = 'visible';
            if (POD) clearInterval(Site.slideInterval);
        };
        Menu.close = function () {
            Menu.state = 'closed';
            if (Menu.closeTimer) clearTimeout(Menu.closeTimer);
            Menu.closeTimer = setTimeout(function () {
                Menu.closeDelay = 0;
                var closedX = -(Menu.getWidth());
                new CSSTween(d.menu, [closedX + 'px'], ['left .8s'], function () {
                    new CSSTween(d.menu, [0], ['opacity .35s']);
                    Menu.buttonShow();
                    Menu.buttonPos();
                    new CSSTween(d.logo, [0], ['opacity .35s']);
                    if (Menu.scroll) Menu.scroll.back.style.visibility = 'hidden';
                    if (POD) d.menu.style.display = 'none';
                });
            }, Menu.closeDelay);
        };
        Menu.mouseEvents = function () {
            var menuBtn = d.menu.getElementsByTagName('a');
            var i = menuBtn.length;
            while (i--) {
                menuBtn[i].style.opacity = 1;
                menuBtn[i].label = menuBtn[i].getElementsByTagName('li')[0];
                if (POD) {
                    if (menuBtn[i].id != 'logo' && Util.findClass(menuBtn[i], 'menuItem')) {
                        var menuBtnRgb = Util.hexToRGB('#000000');
                        menuBtn[i].style.backgroundColor = "rgba(" + menuBtnRgb.r + "," + menuBtnRgb.g + "," + menuBtnRgb.b + "," + 0.15 + ")";
                    }
                }
                if (menuBtn[i].getAttribute('data-link') == 'icon-ext') {
                    menuBtn[i].addEventListener('mouseover', Menu.iconOver, false);
                    menuBtn[i].addEventListener('mouseout', Menu.iconOut, false);
                } else if (menuBtn[i].id != 'logo') {
                    if (Util.findClass(menuBtn[i], 'menuItem')) {
                        Menu.buildBullet(menuBtn[i]);
                        menuBtn[i].addEventListener('mouseover', Menu.mouseOver, false);
                        menuBtn[i].addEventListener('mouseout', Menu.mouseOut, false);
                        if (menuBtn[i].getAttribute('data-link') === 'internal') {
                            menuBtn[i].addEventListener(TOUCH_END, Menu.click, false);
                            menuBtn[i].addEventListener(CLICK, Menu.click, false);
                        }
                    } else if (Util.findClass(menuBtn[i], 'subMenuItem')) {
                        Menu.buildSubBullet(menuBtn[i]);
                        menuBtn[i].addEventListener('mouseover', Menu.mouseOver, false);
                        menuBtn[i].addEventListener('mouseout', Menu.mouseOut, false);
                        if (menuBtn[i].getAttribute('data-link') === 'internal') {
                            menuBtn[i].addEventListener(CLICK, Menu.click, false);
                        }
                    }
                }
            }
        };
        Menu.click = function (event) {
            event.preventDefault();
            if (checkThumbsDefault(this) && !POD) {
                if (Site.curMediaItem) new CSSTween(Site.curMediaItem, [0], ['opacity .15s cubic']);
                Address.setTitle(this.getAttribute('data-label'));
                var ths = this;
                setTimeout(function () {
                    Address.setPath(ths.getAttribute('href') + "thumbs/");
                }, 0);
            } else {
                Address.setPath(this.getAttribute('href') + "1/");
            }
        };
        var checkThumbsDefault = function (menuItem) {
            try {
                var dataThumb = menuItem.getAttribute('data-thumb') || '';
                var thmDataObj = JSON.parse(dataThumb);
                if (dataThumb && thmDataObj.defaultOn) {
                    return true;
                } else {
                    return false;
                }
            } catch (err) {
                console.log('Problem parsing JSON ' + err);
            }
        };
        Menu.getBulletWidth = function () {
            if (Menu.bulletWidth == 0 && 'bullet' != 'none') {
                var bull = document.createElement('div');
                var type = ('bullet').replace(' ', '');
                bull.innerHTML = Menu.bullet[type];
                bull.style.position = 'absolute';
                bull.style.fontWeight = 'normal';
                bull.style.fontSize = '18px';
                bull.style.fontFamily = 'Century Gothic';
                bull.style.display = 'block';
                bull.style.visibility = 'hidden';
                document.body.appendChild(bull);
                Menu.bulletWidth = Util.getStyle(bull, 'width');
                Menu.bulletHeight = Util.getStyle(bull, 'height');
                bull.style.fontSize = '14px';
                Menu.bulletSubWidth = Util.getStyle(bull, 'width');
                Menu.bulletSubHeight = Util.getStyle(bull, 'height');
                document.body.removeChild(bull);
            }
        };
        Menu.buildBullet = function (menuItem) {
            var _height = Util.getStyle(menuItem, 'height');
            var bulletType = ('bullet').replace(' ', '');
            menuItem.innerHTML = "<b>" + Menu.bullet[bulletType] + "</b>" + menuItem.innerHTML;
            menuItem.bullet = menuItem.getElementsByTagName('b')[0];
            menuItem.bullet.bullet = menuItem.bullet;
            menuItem.bullet.style.fontWeight = 'normal';
            menuItem.bullet.style.display = 'inline-block';
            menuItem.bullet.style.position = 'relative';
            menuItem.bullet.offsetX = 0 - 2;
            menuItem.bullet.offsetY = 0 + 0.5;
            menuItem.bullet.style.left = -9 + 'px';
            menuItem.bullet.style.top = ((_height - Menu.bulletHeight) * 0.5) + menuItem.bullet.offsetY + 'px';
            menuItem.bullet.style.opacity = 0.001;
            if ('left' == 'left') {
                menuItem.style.position = 'relative';
                menuItem.style.left = -(Menu.bulletWidth + 0) + 'px';
            } else if ('left' == 'center') {
                menuItem.style.position = 'relative';
                menuItem.style.left = -(Menu.bulletWidth * 0.5) + 'px';
            }
        };
        Menu.buildSubBullet = function (menuItem) {
            var _height = Util.getStyle(menuItem, 'height');
            var bulletType = ('bullet').replace(' ', '');
            menuItem.innerHTML = "<b>" + Menu.bullet[bulletType] + "</b>" + menuItem.innerHTML;
            menuItem.bullet = menuItem.getElementsByTagName('b')[0];
            menuItem.bullet.bullet = menuItem.bullet;
            menuItem.bullet.style.fontWeight = 'normal';
            menuItem.bullet.style.display = 'inline-block';
            menuItem.bullet.style.position = 'relative';
            menuItem.bullet.offsetX = 0 - 2;
            menuItem.bullet.offsetY = 0 + 0.5;
            menuItem.bullet.style.left = -9 + 'px';
            menuItem.bullet.style.top = ((_height - Menu.bulletSubHeight) * 0.5) + menuItem.bullet.offsetY + 'px';
            menuItem.bullet.style.opacity = 0.001;
            if ('left' == 'left') {
                menuItem.style.position = 'relative';
                menuItem.style.left = -(Menu.bulletWidth - 0) + 'px';
            } else if ('left' == 'center') {
                menuItem.style.position = 'relative';
                menuItem.style.left = -(Menu.bulletWidth * 0.5) + 'px';
            }
        };
        Menu.bullet = {
            none: '',
            arrow: '\u203A',
            arrow2: '\u00BB',
            bullet: '\u2022',
            bullet2: '\u00B7',
            dash: '-'
        };
        Menu.mouseOver = function (event) {
            if (event.target != Menu.curBtn) {
                var position = event.target.bullet.offsetX - 2;
                new CSSTween(event.target.bullet, [1, position + 'px', '#989898'], ['opacity .2s', 'left .2s', 'color .2s']);
                new CSSTween(event.target, ['#989898'], ['color .2s']);
            }
        };
        Menu.mouseOut = function (event) {
            if (event.target != Menu.curBtn) {
                new CSSTween(event.target.bullet, [0.001, -9 + 'px', '#000000'], ['opacity .2s', 'left .2s', 'color .2s']);
                new CSSTween(event.target, ['#000000'], ['color .2s']);
            }
        };
        Menu.iconOver = function (event) {
            new CSSTween(event.target, [.5], ['opacity .2s']);
        };
        Menu.iconOut = function (event) {
            new CSSTween(event.target, [1], ['opacity .2s']);
        };
        Menu.select = function () {
            var o = d.menuText.getElementsByTagName('a');
            for (var i = 0; i < o.length; i++) {
                switch (o[i].getAttribute('href') == Address.base + Site.curPath + '/') {
                    case true:
                        Menu.curBtn = o[i];
                    default:
                        if (o[i].getAttribute('data-link') != 'icon-ext') {
                            new CSSTween(o[i], ['#000000'], ['color .2s']);
                            if (o[i].bullet) new CSSTween(o[i].bullet, [0.001, -9 + 'px', '#000000'], ['opacity .2s', 'left .2s', 'color .2s']);
                            if (POD && o[i].id != 'logo' && Util.findClass(o[i], 'menuItem')) {
                                var menuBtnRgb = Util.hexToRGB('#000000');
                                o[i].style.backgroundColor = "rgba(" + menuBtnRgb.r + "," + menuBtnRgb.g + "," + menuBtnRgb.b + "," + 0.15 + ")";
                            } else {
                                o[i].style.backgroundColor = "rgba(0,0,0,0)";
                            }
                        }
                }
            }
            if (Menu.curBtn && Menu.curBtn.getAttribute('data-link') != 'icon-ext' && Address.getPath() != '') {
                if (Menu.curBtn.getAttribute('class') == 'menuItem') Menu.closeDelay = 1500;
                if (Menu.curBtn.getAttribute('class') == 'subMenuItem') Menu.closeDelay = 1500;
                new CSSTween(Menu.curBtn, ['#ff0000'], ['color .3s']);
                var position = Menu.curBtn.bullet.offsetX - 2;
                new CSSTween(Menu.curBtn.bullet, [1, position + 'px', '#ff0000'], ['opacity .3s', 'left .3s', 'color .3s']);
                Menu.expand(Menu.curBtn.getAttribute('data-id'));
                if (POD) {
                    var menuBtnRgb = Util.hexToRGB('#989898');
                    Menu.curBtn.style.backgroundColor = "rgba(" + menuBtnRgb.r + "," + menuBtnRgb.g + "," + menuBtnRgb.b + "," + 0.05 + ")";
                }
            } else if ((POD || PAD) && Menu.state == 'open') {
                Menu.expand('');
            } else if (!POD && !PAD) {
                Menu.expand('');
            }
            if ((PAD || POD) && Menu.state == 'open' && Address.getPath() != '') {
                Menu.close();
            }
        };
        window.Menu = Menu;
    }(window));
    (function (window) {
        var cursor;
        var PREV = 'prev';
        var THUMBS = 'thumbs';
        var NEXT = 'next';

        function Cursor() {
            Cursor.setCursorMouseEvents();
        }
        Cursor.setCursorMouseEvents = function () {
            cursor = document.createElement('div');
            cursor.style.opacity = 0;
            cursor.style.zIndex = 35;
            cursor.style.display = 'block';
            cursor.style.position = 'absolute';
            cursor.setAttribute('class', 'cursor');
            cursor.setAttribute('unselectable', 'on');
            cursor.style.font = "400 8px/0px 'iconsRegular'";
            cursor.style.color = '#ff0000';
            d.site.appendChild(cursor);
            cursor.show = false;
            document.addEventListener('mousemove', Cursor.move, true);
        };
        Cursor.show = function () {
            if (!cursor.show) {
                cursor.show = true;
                cursor.style.display = 'block';
                cursor.style.cursor = 'none';
                new CSSTween(cursor, [.65], ['opacity .35s linear']);
                if (Site.curMediaItem && Site.getMediaAsset(Site.curMediaItem, 'image')) {
                    Site.mediaView.style.cursor = 'none';
                    Site.curMediaItem.style.cursor = 'none';
                    var image = Site.getMediaAsset(Site.curMediaItem, 'image');
                    image.style.cursor = 'none';
                }
                document.addEventListener('click', Cursor.navClick, false);
            }
        };
        Cursor.hide = function () {
            if (cursor.show) {
                cursor.show = false;
                new CSSTween(cursor, [0], ['opacity .1s linear'], function () {
                    document.body.style.cursor = 'default';
                    cursor.style.display = 'none';
                    cursor.style.left = 0 + 'px';
                    cursor.style.top = 0 + 'px';
                    if (Site.curMediaItem && Site.getMediaAsset(Site.curMediaItem, 'image')) {
                        Site.mediaView.style.cursor = 'default';
                        Site.curMediaItem.style.cursor = 'default';
                        var image = Site.getMediaAsset(Site.curMediaItem, 'image');
                        image.style.cursor = 'default';
                    }
                });
                document.removeEventListener('click', Cursor.navClick, false);
            }
        };
        Cursor.navClick = function () {
            switch (cursor.state) {
                case PREV:
                    Site.prev();
                    break;
                case THUMBS:
                    Thumbnails.toggle();
                    break;
                case NEXT:
                    Site.next();
                    break;
            }
        };
        Cursor.move = function (event) {
            var zoneWidth = STAGE_WIDTH * .333;
            var overMediaView = Cursor.overMediaView(event.pageX, event.pageY);
            var overVidPlayBtn = Cursor.overVidPlayBtn(event.pageX, event.pageY);
            var overVidHud = Cursor.overVidHud(event.pageX, event.pageY);
            var overVimeoHud = Cursor.overVimeoHud(event.pageX, event.pageY);
            var overText = Cursor.overText(event.pageX, event.pageY);
            var overLogo = Cursor.overLogo(event.pageX, event.pageY);
            var overNavbar = Cursor.overNavbar(event.pageX, event.pageY);
            var overFooter = Cursor.overFooter(event.pageX, event.pageY);
            var cursorOffsetX = -15;
            var cursorOffsetY = -20;
            var leftMargin = 'left' == 'left' ? 60 + (275 - 34) : 60;
            var rightMargin = 'left' == 'right' ? 25 + (275 + 34) : 25;
            if (!Pass.showing && Address.getPath() != '' && !Thumbnails.open && !Share.open && !overText && overMediaView && event.pageX > leftMargin && event.pageX < (leftMargin + zoneWidth) && !overVidPlayBtn && !overVidHud && !overVimeoHud && !Site.blocker && !overLogo && !overFooter && !overNavbar) {
                cursor.state = PREV;
                cursor.innerHTML = Cursor.getPrevIcon();
                Cursor.show();
                cursor.style.left = event.pageX + cursorOffsetX + 'px';
                cursor.style.top = event.pageY + cursorOffsetY + 'px';
            } else if (!Pass.showing && Address.getPath() != '' && !Thumbnails.open && !Share.open && !overText && overMediaView && event.pageX > (leftMargin + zoneWidth) && event.pageX < (leftMargin + (zoneWidth * 2)) && !overVidPlayBtn && !overVidHud && !overVimeoHud && !Site.blocker && !overLogo && !overFooter && !overNavbar) {
                cursor.state = THUMBS;
                cursor.innerHTML = '\u2026';
                Cursor.show();
                cursor.style.left = event.pageX + cursorOffsetX + 'px';
                cursor.style.top = event.pageY + cursorOffsetY + 'px';
            } else if (!Pass.showing && Address.getPath() != '' && !Thumbnails.open && !Share.open && !overText && overMediaView && event.pageX > (leftMargin + (zoneWidth * 2)) && event.pageX < (window.innerWidth - rightMargin) && !overVidPlayBtn && !overVidHud && !overVimeoHud && !Site.blocker && !overLogo && !overFooter && !overNavbar) {
                cursor.state = NEXT;
                cursor.innerHTML = Cursor.getNextIcon();
                Cursor.show();
                cursor.style.left = event.pageX + cursorOffsetX + 'px';
                cursor.style.top = event.pageY + cursorOffsetY + 'px';
            } else {
                Cursor.hide();
            }
            var overVid = Cursor.overVid(event.pageX, event.pageY);
            if (Site.curMediaItem && Site.curMediaItem.vid && Site.curMediaItem.vid.loaded && overVid && Site.curMediaItem.vid.type !== 'vimeo') {
                Video.showHud();
            } else if (Site.curMediaItem && Site.curMediaItem.vid && Site.curMediaItem.vid.type !== 'vimeo') {
                Video.hideHud();
            }
        };
        Cursor.getPrevIcon = function () {
            switch ('arrow1') {
                case 'arrow1':
                    return '\u03bc';
                    break;
                case 'arrow2':
                    return '\u00ba';
                    break;
                case 'plus1':
                    return '\u00bf';
                    break;
                case 'plus2':
                    return '\u00ac';
                    break;
            }
        };
        Cursor.getNextIcon = function () {
            switch ('arrow1') {
                case 'arrow1':
                    return '\u00aa';
                    break;
                case 'arrow2':
                    return '\u00f8';
                    break;
                case 'plus1':
                    return '\u00a1';
                    break;
                case 'plus2':
                    return '\u00a4';
                    break;
            }
        };
        Cursor.overMediaView = function (mouseX, mouseY) {
            var leftMargin = 'left' == 'left' ? 60 + 275 : 60;
            var rightMargin = 'left' == 'right' ? 25 + 275 : 25;
            if (Site.curMediaItemsInSection > 1 && mouseX > leftMargin && mouseX < window.innerWidth - rightMargin && mouseY > 50 && mouseY < window.innerHeight - 100) {
                return true;
            } else {
                return false;
            }
        };
        Cursor.overVidPlayBtn = function (mouseX, mouseY) {
            if (Site.curMediaItem && Site.curMediaItem.playBtn) {
                var leftMargin = 'left' == 'left' ? 60 + 275 - 34 : 60;
                var rightMargin = 'left' == 'right' ? 25 + 275 - 34 : 25;
                var playBtn = Site.curMediaItem.playBtn;
                var left = parseInt(playBtn.style.left);
                var width = parseInt(playBtn.width);
                var top = parseInt(playBtn.style.top);
                var height = parseInt(playBtn.height);
                if (Site.state == VIDEO && mouseX > leftMargin + left && mouseX < leftMargin + left + width && mouseY > 50 + top && mouseY < 50 + top + height) {
                    return true;
                }
            } else {
                return false;
            }
        };
        Cursor.overVid = function (mouseX, mouseY) {
            if (Site.curMediaItem && Site.curMediaItem.vid) {
                var leftMargin = 'left' == 'left' ? 60 + 275 : 60;
                var rightMargin = 'left' == 'right' ? 25 + 275 : 25;
                var vid = Site.curMediaItem.vid;
                var left = parseInt(vid.style.left);
                var width = parseInt(vid.width);
                var top = parseInt(vid.style.top);
                var height = parseInt(vid.height);
                if (Site.state == VIDEO && mouseX > (leftMargin + left) && mouseX < (leftMargin + left + width) && mouseY > (50 + top) && mouseY < (50 + top + height)) {
                    return true;
                }
            } else {
                return false;
            }
        };
        Cursor.overVidHud = function (mouseX, mouseY) {
            if (Site.curMediaItem && Site.curMediaItem.vid && Site.curMediaItem.vid.hud) {
                var leftMargin = 'left' == 'left' ? 60 + 275 : 60;
                var rightMargin = 'left' == 'right' ? 25 + 275 : 25;
                var vid = Site.curMediaItem.vid;
                var hud = Site.curMediaItem.vid.hud;
                var left = parseInt(hud.style.left);
                var width = parseInt(hud.width);
                var top = parseInt(hud.style.top);
                var height = parseInt(hud.height);
                if (Site.state == VIDEO && mouseX > (leftMargin + left) && mouseX < (leftMargin + left + width) && mouseY > (50 + top) && mouseY < (50 + top + height)) {
                    return true;
                }
            } else {
                return false;
            }
        };
        Cursor.overVimeoHud = function (mouseX, mouseY) {
            if (Site.curMediaItem && Site.curMediaItem.vid && Site.curMediaItem.vid.type === 'vimeo') {
                var leftMargin = 'left' == 'left' ? 60 + 275 : 60;
                var rightMargin = 'left' == 'right' ? 25 + 275 : 25;
                var vid = Site.curMediaItem.vid;
                var left = parseInt(vid.style.left);
                var width = parseInt(vid.width);
                var height = parseInt(vid.height);
                var top = parseInt(vid.style.top) + height - 60;
                if (Site.state == VIDEO && Site.curMediaItem.vid.type == 'vimeo' && mouseX > (leftMargin + left) && mouseX < (leftMargin + left + width) && mouseY > (50 + top) && mouseY < (50 + top + height)) {
                    return true;
                }
            } else {
                return false;
            }
        };
        Cursor.overLogo = function (mouseX, mouseY) {
            if (d.logo) {
                var logo = d.logo;
                var left = isNaN(Util.getStyle(logo, 'left')) ? window.innerWidth - Util.getStyle(logo, 'width') : Util.getStyle(logo, 'left');
                var width = Util.getStyle(logo, 'width');
                var top = isNaN(Util.getStyle(logo, 'top')) ? window.innerHeight - Util.getStyle(logo, 'height') : Util.getStyle(logo, 'top');
                var height = Util.getStyle(logo, 'height');
                if (mouseX > left && mouseX < left + width && mouseY > top && mouseY < top + height) {
                    return true;
                }
            } else {
                return false;
            }
        };
        Cursor.overFooter = function (mouseX, mouseY) {
            if (Site.site.getElementsByTagName('footer')[0]) {
                var footer = Site.site.getElementsByTagName('footer')[0];
                var left = isNaN(Util.getStyle(footer, 'left')) ? window.innerWidth - Util.getStyle(footer, 'width') : Util.getStyle(footer, 'left');
                var width = Util.getStyle(footer, 'width');
                var top = isNaN(Util.getStyle(footer, 'top')) ? window.innerHeight - Util.getStyle(footer, 'height') : Util.getStyle(footer, 'top');
                var height = Util.getStyle(footer, 'height');
                if (mouseX > left && mouseX < left + width && mouseY > top && mouseY < top + height) {
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        };
        Cursor.overNavbar = function (mouseX, mouseY) {
            if (Site.site.getElementsByTagName('nav')[0]) {
                var nav = Site.site.getElementsByTagName('nav')[0];
                var left = isNaN(Util.getStyle(nav, 'left')) ? window.innerWidth - Util.getStyle(nav, 'width') : Util.getStyle(nav, 'left');
                var width = Util.getStyle(nav, 'width');
                var top = isNaN(Util.getStyle(nav, 'top')) ? window.innerHeight - Util.getStyle(nav, 'height') : Util.getStyle(nav, 'top');
                var height = Util.getStyle(nav, 'height');
                if (mouseX > left && mouseX < left + width && mouseY > top && mouseY < top + height) {
                    return true;
                }
            } else {
                return false;
            }
        };
        Cursor.overText = function (mouseX, mouseY) {
            if (Site.curMediaItem && Site.getMediaAsset(Site.curMediaItem, 'textMask')) {
                var leftMargin = 'left' == 'left' ? 60 + 275 : 60;
                var rightMargin = 'left' == 'right' ? 25 + 275 : 25;
                var text = Site.getMediaAsset(Site.curMediaItem, 'textMask');
                if ('left' == 'left') {
                    var left = Util.getStyle(text, "left") - 30 - Scroll.active.width;
                } else {
                    var left = Util.getStyle(text, "left");
                }
                var top = Util.getStyle(text, "top");
                var width = Util.getStyle(text, "width");
                var height = Util.getStyle(text, "height");
                if (Site.state == HTML && mouseX > (leftMargin + left) && mouseX < (leftMargin + left + width + 30 + Scroll.active.width) && mouseY > (50 + top) && mouseY < (50 + top + height)) {
                    return true;
                }
            } else {
                return false;
            }
        };
        window.Cursor = Cursor;
    }(window));
    (function (window) {
        Loader.type = 'spinner';
        Loader.alpha = .75;
        Loader.color = '#FFFFFF';
        Loader.loaders = [];

        function Loader(obj, type, alpha, color) {
            if (type) Loader.type = type;
            if (alpha) Loader.alpha = alpha;
            if (color) Loader.color = color;
            var loader;
            if (obj.loader) {
                loader = obj.loader;
                Loader.active = loader;
            } else {
                loader = document.createElement('div');
                loader.style.display = 'block';
                loader.style.position = 'absolute';
                loader.style.width = '24px';
                loader.style.height = '24px';
                loader.style.overflow = 'hidden';
                switch (Loader.type) {
                    case 'none':
                        break;
                    case 'horizontal line':
                        break;
                    case 'vertical line':
                        break;
                    case 'percent':
                        break;
                    case 'spinner':
                        loader.spinner = Loader.spinner(Loader.color);
                        loader.spinner.style.position = 'absolute';
                        loader.appendChild(loader.spinner);
                        break;
                }
                obj.loader = loader;
                obj.appendChild(loader);
                Loader.active = loader;
                Loader.loaders.push(loader);
            }
            Loader.align(obj);
            Loader.animate(loader);
            loader.style.opacity = 0;
            new CSSTween(loader, [Loader.alpha], ['opacity .35s cubic']);
        }
        Loader.animate = function (loader) {
            if (loader.spinner) {
                loader.interval = setInterval(function () {
                    Loader.inc(loader)
                }, 80);
            }
        };
        Loader.inc = function (loader) {
            if (loader.spinner) {
                loader.spinner.style.top = loader.loc + 'px';
                loader.loc > -264 ? loader.loc -= 24 : loader.loc = 0;
            }
        };
        Loader.spinner = function (tint) {
            switch (tint) {
                case '#FFFFFF':
                    return Loader.light ? Loader.light : Loader.img('loader1.png');
                    break;
                case '#000000':
                    return Loader.dark ? Loader.dark : Loader.img('loader2.png');
                    break;
            }
        };
        Loader.img = function (src) {
            var img = document.createElement('img');
            img.setAttribute('src', Address.base + 'inc/icn/' + src);
            img.setAttribute('width', '24');
            img.setAttribute('height', '288');
            return img;
        };
        Loader.remove = function (obj) {
            if (obj.loader) {
                setTimeout(function () {
                    clearInterval(obj.loader.interval);
                    obj.loader.style.display = 'none';
                }, 360);
                new CSSTween(obj.loader, [0], ['opacity .35s cubic']);
            }
        };
        Loader.align = function (obj) {
            var left = Math.floor(parseInt(obj.style.width) * 0.5) - 12;
            var top = Math.floor(parseInt(obj.style.height) * 0.5) - 12;
            new CSSTween(obj.loader, [left + 'px', top + 'px'], ['left 0s linear', 'top 0s linear']);
        };
        window.Loader = Loader;
    }(window));

    (function (window) {
        function Fullscreen() {
            Fullscreen.toggle();
            document.addEventListener('webkitfullscreenchange', Fullscreen.change, false);
        }
        Fullscreen.toggle = function () {
            if (document.isFullScreen | document.mozIsFullScreen | document.webkitIsFullScreen) {
                Fullscreen.exit();
            } else {
                Fullscreen.enter();
            }
        };
        Fullscreen.enter = function () {
            if (document.documentElement.requestFullScreen) {
                document.documentElement.requestFullScreen();
            } else if (document.documentElement.mozRequestFullScreen) {
                document.documentElement.mozRequestFullScreen();
            } else if (document.documentElement.webkitRequestFullScreen) {
                document.documentElement.webkitRequestFullScreen();
                document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
                if (Chrome) Address.addHash();
            }
            Tooltip.hide();
        };
        Fullscreen.exit = function () {
            if (document.cancelFullScreen) {
                document.cancelFullScreen();
            } else if (document.mozCancelFullScreen) {
                document.mozCancelFullScreen();
            } else if (document.webkitCancelFullScreen) {
                document.webkitCancelFullScreen();
            }
        };
        Fullscreen.i = function (event) {
            var vid = event.target.parent.vid;
            if (document.webkitIsFullScreen) {
                document.webkitCancelFullScreen();
            } else {
                vid.webkitEnterFullscreen();
            }
            document.addEventListener('webkitfullscreenchange', Fullscreen.change, false);
            if (POD && Site.curMediaItem) {
                TouchNav.addListeners(Site.curMediaItem);
            }
        };
        Fullscreen.PodInterval = null;
        Fullscreen.checkPOD = function () {
            var isFull = document.isFullScreen | document.mozIsFullScreen | document.webkitIsFullScreen;
            var vid = Site.getMediaAsset(Site.curMediaItem, VIDEO);
            if (!vid.webkitDisplayingFullscreen) {
                clearInterval(Fullscreen.PodInterval);
                var img = Site.getMediaAsset(vid.mediaItem, IMAGE);
                new CSSTween(img, [1], ['opacity .7s cubic']);
                Video.resize(vid);
                var bigPlayBtn = vid.mediaItem.playBtn;
                new CSSTween(bigPlayBtn, [.56], ['opacity .7s cubic']); /*bigPlayBtn.addEventListener(SELECT_EVENT,Video.bigPlay,false);*/
            }
        };
        Fullscreen.change = function () {
            var isFull = document.isFullScreen | document.mozIsFullScreen | document.webkitIsFullScreen;
            Site.resize();
        };
        Fullscreen.Available = function () {
            return true;
        };
        window.Fullscreen = Fullscreen;
    }(window));

    (function (window) {
        function Navbar() {
            Navbar.mouseEvents();
        }
        Navbar.mouseEvents = function () {
            var nav = Site.site.getElementsByTagName('nav')[0].getElementsByTagName('a');
            var i = nav.length;
            while (i--) {
                if (nav[i].getElementsByTagName('icon')[0]) {
                    nav[i].icon = nav[i].getElementsByTagName('icon')[0];
                    nav[i].icon.label = nav[i].getElementsByTagName('label')[0];
                }
                if (nav[i].getElementsByTagName('label')[0]) {
                    nav[i].label = nav[i].getElementsByTagName('label')[0];
                    nav[i].label.icon = nav[i].getElementsByTagName('icon')[0];
                }
                nav[i].listener = false;
                Navbar.btnAction(nav[i]);
            }
        };
        Navbar.listeners = function (btn, active) {
            if (active) {
                new CSSTween(btn, [1], ['opacity .3s cubic']);
                if (!btn.listener) {
                    if (touchDevice) {
                        btn.addEventListener(TOUCH_START, Navbar.over, false);
                        btn.addEventListener(TOUCH_END, Navbar.out, false);
                    } else {
                        btn.addEventListener(MOUSE_OVER, Navbar.over, false);
                        btn.addEventListener(MOUSE_OUT, Navbar.out, false);
                    }
                    btn.listener = true;
                }
            } else {
                new CSSTween(btn, [0.25], ['opacity .3s cubic']);
                if (touchDevice) {
                    btn.removeEventListener(TOUCH_START, Navbar.over, false);
                    btn.removeEventListener(TOUCH_END, Navbar.out, false);
                } else {
                    btn.removeEventListener(MOUSE_OVER, Navbar.over, false);
                    btn.removeEventListener(MOUSE_OUT, Navbar.out, false);
                }
                btn.listener = false;
            }
        };
        Navbar.btnAction = function (btn) {
            switch (btn.type) {
                case 'fullscreen':
                    if (Fullscreen.Available()) {
                        btn.setAttribute('onclick', 'Fullscreen();');
                        Navbar.listeners(btn, true);
                    } else {
                        btn.setAttribute('onclick', '');
                        Navbar.listeners(btn, false);
                    }
                    break;
                case 'caption':
                    if (Caption.getCur() && Address.getPath() != '') {
                        btn.setAttribute('onclick', 'Caption.toggle();');
                        Navbar.listeners(btn, true);
                    } else {
                        btn.setAttribute('onclick', '');
                        Navbar.listeners(btn, false);
                    }
                    break;
                case 'thumbs':
                    if (Site.numItemsInSection > 1 && Address.getPath() != '' && Site.curImgNum > 0) {
                        btn.setAttribute('onclick', 'Thumbnails.toggle();');
                        Navbar.listeners(btn, true);
                    } else {
                        btn.setAttribute('onclick', '');
                        Navbar.listeners(btn, false);
                    }
                    break;
                case 'email':
                    if (Address.getPath() != '' && (Site.state == IMAGE || Site.state == VIDEO)) {
                        btn.setAttribute('onclick', 'Share.toggle();');
                        Navbar.listeners(btn, true);
                    } else {
                        btn.setAttribute('onclick', '');
                        Navbar.listeners(btn, false);
                    }
                    break;
                case 'prev':
                    if (Site.numItemsInSection > 1 && Address.getPath() != '' && Site.curImgNum > 0) {
                        btn.setAttribute('onclick', 'Site.prev();');
                        Navbar.listeners(btn, true);
                    } else {
                        btn.setAttribute('onclick', '');
                        Navbar.listeners(btn, false);
                    }
                    break;
                case 'count':
                    if (Site.numItemsInSection > 1 && Site.curImgNum > 0) {
                        btn.style.opacity = 0.65;
                        btn.getElementsByTagName('label')[0].innerHTML = Site.curImgNum + " of " + Site.numItemsInSection;
                    } else if (Site.numItemsInSection > 1 && Site.curImgNum === 0) {
                        btn.style.opacity = 0.65;
                        btn.getElementsByTagName('label')[0].innerHTML = Site.curImgNum + " of " + Site.numItemsInSection;
                    } else {
                        btn.style.opacity = .65;
                        btn.getElementsByTagName('label')[0].innerHTML = Site.curImgNum + " of " + Site.numItemsInSection;
                    }
                    break;
                case 'next':
                    if (Site.numItemsInSection > 1 && Address.getPath() != '' && Site.curImgNum > 0) {
                        btn.setAttribute('onclick', 'Site.next();');
                        Navbar.listeners(btn, true);
                    } else {
                        btn.setAttribute('onclick', '');
                        Navbar.listeners(btn, false);
                    }
                    break;
            }
        };
        Navbar.over = function (event) {
            var tip = event.target.getAttribute('alt') ? event.target.getAttribute('alt') : event.target.parentNode.getAttribute('alt');
            if (Site.tooltip) Tooltip.text(tip);
            new CSSTween(event.target, ['#ff0000'], ['color .3s cubic']);
            if (event.target.icon) new CSSTween(event.target.icon, ['#ff0000'], ['color .3s cubic']);
            if (event.target.label) new CSSTween(event.target.label, ['#ff0000'], ['color .3s cubic']);
        };
        Navbar.out = function (event) {
            if (Site.tooltip) Tooltip.hide();
            new CSSTween(event.target, ['#989898'], ['color .3s cubic']);
            if (event.target.icon) new CSSTween(event.target.icon, ['#989898'], ['color .3s cubic']);
            if (event.target.label) new CSSTween(event.target.label, ['#989898'], ['color .3s cubic']);
        };
        Navbar.resize = function () {
            if ('center' == 'center') {
                var width = Util.getStyle(Site.nav, 'width');
                Site.nav.style.left = ((window.innerWidth - width) * 0.5) + 130 + 'px';
            }
            if ('bottom' == 'center') {
                var height = Util.getStyle(Site.nav, 'height');
                Site.nav.style.top = ((window.innerHeight - height) * 0.5) + 50 + 'px';
            }
        };
        Navbar.check = function () {
            Site.state == INTRO ? Navbar.hide() : Navbar.show();
        };
        Navbar.show = function () {
            Site.nav.style.display = 'block';
            Navbar.resize();
            new CSSTween(Site.nav, [1], ['opacity .5s linear']);
        };
        Navbar.hide = function () {
            new CSSTween(Site.nav, [0], ['opacity .5s linear'], function () {
                Site.nav.style.display = 'none';
            });
        };
        Navbar.setCount = function () {
            Navbar.mouseEvents();
        };
        window.Navbar = Navbar;
    }(window));

    (function (window) {
        function Footer() {
            Footer.mouseEvents();
        }
        Footer.mouseEvents = function () {
            var footer = document.getElementsByTagName('footer')[0].getElementsByTagName('a');
            var i = footer.length;
            while (i--) {
                footer[i].addEventListener('mouseover', Footer.iconOver, false);
                footer[i].addEventListener('mouseout', Footer.iconOut, false);
            }
        };
        Footer.iconOver = function (event) {
            new CSSTween(event.target, [.5], ['opacity .2s cubic']);
        };
        Footer.iconOut = function (event) {
            new CSSTween(event.target, [1], ['opacity .2s cubic']);
        };
        Footer.resize = function () {
            var footer = document.getElementsByTagName('footer')[0];
            if ('left' == 'center') {
                footer.style.left = ((window.innerWidth - Util.getStyle(footer, 'width')) * 0.5) + 80 + 'px';
            }
            if ('bottom' == 'center') {
                footer.style.top = ((window.innerHeight - Util.getStyle(footer, 'height')) * 0.5) + 50 + 'px';
            }
        };
        window.Footer = Footer;
    }(window));

    (function (window) {
        Thumbnails.open = false;
        Thumbnails.masonry = false;
        Thumbnails.arr = [];
        Thumbnails.index = 0;
        Thumbnails.resizing = false;
        Thumbnails.loading = false;
        Thumbnails.sequential = false;
        Thumbnails.size = {
            small: {
                width: 100,
                height: 66
            },
            medium: {
                width: 200,
                height: 133
            },
            large: {
                width: 300,
                height: 200
            }
        };

        function Thumbnails() {
            buildThumbs();
        }
        function buildThumbs() {
            var thm = document.createElement('div');
            thm.style.position = 'absolute';
            thm.style.opacity = 0;
            thm.style.display = 'none';
            thm.style.zIndex = 30;
            thm.style.left = Util.getStyle(d.mediaView, 'left') + 'px';
            thm.style.top = Util.getStyle(d.mediaView, 'top') + 'px';
            thm.style.overflow = 'hidden';
            thm.setAttribute('class', 'thumbs');
            thm.bg = document.createElement('div');
            thm.bg.style.position = 'absolute';
            thm.bg.style.display = 'block';
            thm.bg.style.overflow = 'hidden';
            var thumbsRgb = Util.hexToRGB('#ffffff');
            thm.bg.style.backgroundColor = "rgba(" + thumbsRgb.r + "," + thumbsRgb.g + "," + thumbsRgb.b + "," + 1 + ")";
            thm.appendChild(thm.bg);
            thm.bg.addEventListener(CLICK, Thumbnails.toggle, false);
            thm.bg.gal = document.createElement('div');
            thm.bg.gal.style.position = 'absolute';
            thm.bg.gal.style.display = 'block';
            thm.bg.gal.style.width = (STAGE_WIDTH - (50 * 2)) + 'px';
            thm.bg.gal.style.height = 0 + 'px';
            thm.bg.gal.height = 0;
            thm.bg.gal.style.top = 50 + 'px';
            thm.appendChild(thm.bg.gal);
            thm.bg.gal.label = document.createElement('h3');
            thm.bg.gal.label.style.position = 'relative';
            thm.bg.gal.label.style.display = 'block';
            thm.bg.gal.label.style.color = '#ff0000';
            thm.bg.gal.label.style.fontSize = 16 + 'px';
            thm.bg.gal.label.style.fontFamily = 'Arial';
            thm.bg.gal.label.style.paddingBottom = 5 + 'px';
            thm.bg.gal.appendChild(thm.bg.gal.label);
            thm.bg.gal.line = document.createElement('hr');
            thm.bg.gal.line.style.position = 'relative';
            thm.bg.gal.line.style.width = (STAGE_WIDTH - (50 * 2)) + 'px';
            thm.bg.gal.line.style.height = 1 + 'px';
            thm.bg.gal.line.style.top = 4 + 'px';
            thm.bg.gal.line.style.border = 0;
            thm.bg.gal.line.style.color = '#ff0000';
            thm.bg.gal.line.style.backgroundColor = '#ff0000';
            thm.bg.gal.appendChild(thm.bg.gal.line);
            d.site.appendChild(thm);
            Thumbnails.thm = thm;
            Site.thumbs = thm;
        }
        function buildThumbHolders() {
            if (Site.thumbs.bg.gal.grid) Site.thumbs.bg.gal.removeChild(Site.thumbs.bg.gal.grid);
            Site.thumbs.bg.gal.grid = document.createElement('div');
            Site.thumbs.bg.gal.grid.style.position = 'relative';
            Site.thumbs.bg.gal.grid.style.display = 'block';
            Site.thumbs.bg.gal.appendChild(Site.thumbs.bg.gal.grid);
            Thumbnails.arr = [];
            Thumbnails.index = 0;
            var length = Site.curMediaItems.length;
            buildHolder(Thumbnails.index);
            var scrollBarWidth = PAD ? 0 : 6;
            if ('scrollbar' === 'scrollbar' || PAD) {
                if (!Thumbnails.scroll) Thumbnails.scroll = new Scroll(Site.thumbs.bg.gal, Site.thumbs, {
                        width: scrollBarWidth,
                        align: 'right',
                        hOffset: -10,
                        vOffset: 0,
                        topPad: 50,
                        bottomPad: 50,
                        color: '#000000',
                        hover: '#ff0000',
                        name: 'thumbnails'
                    });
            } else if ('scrollbar' === 'mouse cursor') {
                Thumbnails.scrollCursor = new ScrollCursor(Site.thumbs.bg.gal, Site.thumbs);
            }
        }
        function buildHolder(i) {
            var mediaItems = Site.curMediaItems;
            var thumbWidth = Thumbnails.size['medium']['width'];
            var thumbHeight = Thumbnails.size['medium']['height'];
            var gap = 10;
            var holder = document.createElement('div');
            holder.style.display = 'block';
            holder.style.position = 'absolute';
            holder.style.width = Thumbnails.size['medium']['width'] + 'px';
            holder.style.height = Thumbnails.size['medium']['height'] + 'px';
            var bc = Util.hexToRGB('#ffffff');
            holder.style.border = '1px solid ' + "rgba(" + bc.r + "," + bc.g + "," + bc.b + "," + 0 + ")";
            Thumbnails.bgRgb = Util.hexToRGB('#ffffff');
            holder.style.backgroundColor = "rgba(" + Thumbnails.bgRgb.r + "," + Thumbnails.bgRgb.g + "," + Thumbnails.bgRgb.b + "," + 0 + ")";
            holder.style.overflow = 'hidden';
            holder.index = i;
            holder.type = mediaItems[i].getAttribute('data-type');
            var file = mediaItems[i].getAttribute('data-thumb');
            holder.file = file ? encodeURIComponent(file) : '';
            Site.thumbs.bg.gal.grid.appendChild(holder);
            holder.thumbHolder = holder;
            holder.loading = false;
            Thumbnails.arr.push(holder);
            Site.thumbs.bg.gal.grid.thumbsArr = Thumbnails.arr;
            loadThumb(holder);
            if (i >= Site.curImgNum - 1) {
                Thumbnails.highlightThumb();
            }
            holder.addEventListener(CLICK, click, false);
            holder.addEventListener(TOUCH_END, click, false);
            holder.addEventListener('mouseover', mouseOver, false);
            holder.addEventListener('mouseout', mouseOut, false);
        }
        function loadThumb(holder) {
            if (!holder.loading) {
                holder.loading = true;
                var thmWidth = Thumbnails.size['medium']['width'];
                var thmHeight;
                if (Thumbnails.masonry && (holder.type === IMAGE || holder.type === VIDEO)) {
                    thmHeight = 1000;
                } else {
                    thmHeight = Thumbnails.size['medium']['height'];
                }
                var thumbQuery;
                if (RETINA) {
                    thumbQuery = '?w=' + thmWidth * 2 + '&h=' + thmHeight * 2 + '&f=';
                } else {
                    thumbQuery = '?w=' + thmWidth + '&h=' + thmHeight + '&f=';
                }
                var src = '';
                switch (holder.type) {
                    case IMAGE:
                        src = 'media/thumb/' + thumbQuery + holder.file;
                        break;
                    case VIDEO:
                        src = holder.file == '' ? 'inc/icn/video@2x.png' : 'media/thumb/' + thumbQuery + holder.file;
                        break;
                    case HTML:
                        src = holder.file == '' ? 'inc/icn/text@2x.png' : 'media/thumb/' + thumbQuery + holder.file;
                        break;
                    case SWF:
                        src = holder.file == '' ? 'inc/icn/swf@2x.png' : 'media/thumb/' + thumbQuery + holder.file;
                        break;
                    case LINK:
                        src = holder.file == '' ? 'inc/icn/link@2x.png' : 'media/thumb/' + thumbQuery + holder.file;
                        break;
                    case PDF:
                        src = holder.file == '' ? 'inc/icn/pdf@2x.png' : 'media/thumb/' + thumbQuery + holder.file;
                        break;
                    case CONTACT:
                        src = holder.file == '' ? 'inc/icn/contact@2x.png' : 'media/thumb/' + thumbQuery + holder.file;
                        break;
                }
                var img = document.createElement('img');
                img.thumbHolder = holder;
                img.style.opacity = 0;
                img.style.position = 'absolute';
                img.setAttribute('class', IMAGE);
                img.setAttribute('src', Address.base + src);
                var avg = (Thumbnails.bgRgb.r + Thumbnails.bgRgb.g + Thumbnails.bgRgb.b) * 0.33;
                var tint = avg < 128 ? '#FFFFFF' : '#000000';
                var loader = new Loader(holder, 'spinner', .4, tint);
                img.addEventListener('load', thumbLoaded, false);
                img.addEventListener('error', thumbError, false);
            }
            if (Thumbnails.index + 1 < Site.curMediaItems.length && !Thumbnails.sequential) {
                setTimeout(function () {
                    Thumbnails.index += 1;
                    buildHolder(Thumbnails.index);
                    if (!Thumbnails.resizing) {
                        Thumbnails.resize();
                    }
                }, 0);
            }
        }
        function thumbLoaded(event) {
            var img = event.target;
            var holder = img.thumbHolder;
            img.index = holder.index;
            if (holder.file !== '') {
                if (RETINA) {
                    img.setAttribute('width', img.width * 0.5);
                    img.setAttribute('height', img.height * 0.5);
                } else {
                    img.setAttribute('width', img.width);
                    img.setAttribute('height', img.height);
                }
                if (Thumbnails.masonry) {
                    holder.style.height = img.height + 'px'
                };
            } else {
                img.setAttribute('width', Thumbnails.size['medium']['width']);
                img.setAttribute('height', Thumbnails.size['medium']['height']);
            }
            img.style.opacity = 0;
            holder.appendChild(img);
            Loader.remove(holder);
            if (Thumbnails.masonry) {
                img.style.left = 0 + 'px';
                img.style.top = 0 + 'px';
            } else {
                alignThumb(img);
            }
            new CSSTween(img, [1], ['opacity .5s cubic']);
            if (holder.type === VIDEO) buildPlayIcon(holder, img.width, img.height);
            if (Thumbnails.index + 1 < Site.curMediaItems.length) {
                if (Thumbnails.sequential) {
                    Thumbnails.index += 1;
                    buildHolder(Thumbnails.index);
                }
            }
            if (Thumbnails.arr.length === Site.curMediaItems.length) {
                Thumbnails.loading = false;
            }
            if (!Thumbnails.resizing) {
                Thumbnails.resize();
            }
            holder.loading = false;
            holder.loaded = true;
        }
        function thumbError(e) {
            if (Thumbnails.index + 1 < Site.curMediaItems.length) {
                if (Thumbnails.sequential) {
                    Thumbnails.index += 1;
                    buildHolder(Thumbnails.index);
                }
            }
        }
        function alignThumb(img) {
            var thumbWidth = Thumbnails.size['medium']['width'];
            var thumbHeight = Thumbnails.size['medium']['height'];
            if (img.width > Thumbnails.size['medium']['width']) {
                img.width = Thumbnails.size['medium']['width'];
            }
            if (img.height > Thumbnails.size['medium']['height']) {
                img.height = Thumbnails.size['medium']['height'];
            }
            var left = Math.round((thumbWidth - img.width) * 0.5);
            var top = Math.round((thumbHeight - img.height) * 0.5);
            img.style.left = left + 'px';
            img.style.top = top + 'px';
        }
        function buildPlayIcon(holder, width, height) {
            var playBtn = document.createElement('img');
            playBtn.setAttribute('class', 'playBtn');
            playBtn.setAttribute('src', Address.base + 'inc/icn/play@2x.png');
            playBtn.setAttribute('width', '50');
            playBtn.setAttribute('height', '50');
            playBtn.style.opacity = 0;
            playBtn.style.position = 'absolute';
            playBtn.style.zIndex = 4;
            playBtn.thumbHolder = holder;
            playBtn.index = holder.index;
            var left = Math.floor((width - 50) * 0.5);
            var top = Math.floor((height - 50) * 0.5);
            new CSSTween(playBtn, [left + 'px', top + 'px', 1], ['left 0s linear', 'top 0s linear', 'opacity .2s cubic']);
            holder.appendChild(playBtn);
        }
        function click(event) {
            if (Thumbnails.scrollCursor) {
                var mediaNum = Number(event.target.index) + 1;
                Address.setPath(Site.curPath + "/" + mediaNum);
            } else if (Thumbnails.scroll && !Thumbnails.scroll.scrolling) {
                var mediaNum = Number(event.target.index) + 1;
                Address.setPath(Site.curPath + "/" + mediaNum);
            }
        }
        function mouseOver(event) {
            if (this.thumbHolder) {
                var bc = Util.hexToRGB('#ffffff');
                new CSSTween(this.thumbHolder, ['1px solid ' + 'rgba(' + bc.r + ',' + bc.g + ',' + bc.b + ',' + 1 + ')'], ['border .35s cubic']);
            }
        }
        function mouseOut(event) {
            if ((Site.curImgNum - 1) != this.index && this.thumbHolder) {
                var bc = Util.hexToRGB('#ffffff');
                new CSSTween(this.thumbHolder, ['1px solid ' + 'rgba(' + bc.r + ',' + bc.g + ',' + bc.b + ',' + 0 + ')'], ['border .35s cubic']);
            } else if (this.thumbHolder) {
                var bc = Util.hexToRGB('#ff0000');
                new CSSTween(this.thumbHolder, ['1px solid ' + 'rgba(' + bc.r + ',' + bc.g + ',' + bc.b + ',' + 1 + ')'], ['border .35s cubic']);
            }
        }
        Thumbnails.highlightThumb = function () {
            if (Site.curImgNum > 0) {
                new CSSTween(Site.thumbs.bg.gal.grid.thumbsArr[Site.curImgNum - 1], ['1px solid #ff0000'], ['border .35s cubic']);
            } else { /* no highlight */ }
        };
        var checkMasonry = function () {
            var section = Site.getCurSection();
            if (section && section.getAttribute('data-thumb')) {
                try {
                    Thumbnails.masonry = JSON.parse(section.getAttribute('data-thumb')).masonry ? true : false;
                } catch (err) {
                    console.log('Problem parsing JSON ' + err);
                }
            } else {
                Thumbnails.masonry = false;
            }
        };
        Thumbnails.loadCurrentSection = function () {
            Thumbnails.loading = true;
            checkMasonry();
            if (Site.curSection[1]) {
                Site.thumbs.bg.gal.label.innerHTML = Site.curSection[1].replace(/-/g, ' ');
            } else {
                Site.thumbs.bg.gal.label.innerHTML = Site.curSection[0].replace(/-/g, ' ');
            }
            buildThumbHolders();
            if (Thumbnails.scroll) Thumbnails.scroll.percent = 0;
            if (Thumbnails.scrollCursor) {
                Thumbnails.scrollCursor.xform(Thumbnails.scrollCursor.obj, 'translateY', 0 + 'px');
                Thumbnails.scrollCursor.obj.style.top = 50 + 'px';
            }
        };
        Thumbnails.show = function () {
            Thumbnails.loadCurrentSection();
            Site.thumbs.style.display = 'block';
            new CSSTween(Site.thumbs, [1], ['opacity .25s cubic']);
            Thumbnails.open = true;
            Site.resize();
        };
        Thumbnails.hide = function () {
            if (Site.curImgNum > 0) {
                new CSSTween(Site.thumbs, [0], ['opacity .25s cubic'], function (ths) {
                    ths.style.display = 'none';
                    if (Thumbnails.scroll) Thumbnails.scroll.checkScrollVisible();
                });
                Thumbnails.open = false;
            }
        };
        Thumbnails.toggle = function () {
            if (Thumbnails.open && Site.curImgNum > 0) {
                Address.setPath(Site.curPath + "/" + Site.curImgNum);
            } else if (Site.curImgNum > 0) {
                Address.setPath(Site.curPath + "/" + Site.curImgNum + "/thumbs");
            }
        };
        Thumbnails.resize = function () {
            Thumbnails.resizing = true;
            var thumbs = Thumbnails.arr,
                gap = 10,
                thumbX = 1,
                thumbY = 10 + gap,
                thumbWidth = Thumbnails.size['medium']['width'],
                thumbHeight = Thumbnails.size['medium']['height'],
                gridAvailWidth = (STAGE_WIDTH - (50 * 2)),
                gridNumWidth = Math.floor(gridAvailWidth / (thumbWidth + gap)) > 0 ? Math.floor(gridAvailWidth / (thumbWidth + gap)) : 1,
                gridNumHeight = 1,
                gridWidth = gridNumWidth * (thumbWidth + 1) + ((gridNumWidth - 1) * gap),
                maxColumnHeight = 0;
            Site.thumbs.style.width = STAGE_WIDTH + 'px';
            Site.thumbs.style.height = STAGE_HEIGHT + 'px';
            new CSSTween(Site.thumbs, [Util.getStyle(d.mediaView, 'left') + 'px', Util.getStyle(d.mediaView, 'top') + 'px'], ['left 0s', 'top 0s']);
            Site.thumbs.bg.style.width = STAGE_WIDTH + 'px';
            Site.thumbs.bg.style.height = STAGE_HEIGHT + 'px';
            for (var i = 0; i < thumbs.length; i++) {
                thumbY = getThumbsAbove(i, gridNumWidth);
                if (thumbY > maxColumnHeight) {
                    maxColumnHeight = thumbY;
                }
                thumbHeight = Util.getStyle(thumbs[i], 'height');
                if (!thumbs[i].loaded) {
                    thumbs[i].style.left = thumbX + 'px';
                    thumbs[i].style.top = thumbY + 'px';
                } else {
                    new CSSTween(thumbs[i], [thumbX + 'px', thumbY + 'px'], ['left .5s', 'top .5s']);
                }
                thumbX += thumbWidth + gap;
                if (thumbX + thumbWidth > gridWidth && i < thumbs.length - 1) {
                    thumbX = 1;
                }
                Site.thumbs.bg.gal.height = maxColumnHeight + thumbHeight + Util.getStyle(Site.thumbs.bg.gal.label, 'height') + 10;
                new CSSTween(Site.thumbs.bg.gal, [Site.thumbs.bg.gal.height + 'px'], ['height .5s']); /* done resizing*/
                if (i === thumbs.length - 1) {
                    Thumbnails.resizing = false;
                }
            }
            if (!Thumbnails.resizing) {
                new CSSTween(Site.thumbs.bg.gal.grid, [gridWidth + 'px'], ['width 0s']);
                new CSSTween(Site.thumbs.bg.gal.line, [gridWidth + 'px'], ['width 0s']);
                new CSSTween(Site.thumbs.bg.gal, [((STAGE_WIDTH - gridWidth) * 0.5) + 'px', gridWidth + 'px'], ['left 0s', 'width 0s']);
            } else {
                new CSSTween(Site.thumbs.bg.gal.grid, [gridWidth + 'px'], ['width .5s']);
                new CSSTween(Site.thumbs.bg.gal.line, [gridWidth + 'px'], ['width .5s']);
                new CSSTween(Site.thumbs.bg.gal, [((STAGE_WIDTH - gridWidth) * 0.5) + 'px', gridWidth + 'px'], ['left .5s', 'width .5s']);
            }
            if (Thumbnails.scroll && !Thumbnails.resizing) {
                Scroll.resize();
            } else if ('scrollbar' === 'mouse cursor' && Thumbnails.scrollCursor) {
                ScrollCursor.resize();
            }
        };

        function getThumbsAbove(i, gridNumWidth) {
            var gap = 10,
                thumbs = Thumbnails.arr,
                thumbsAbove = Math.floor(i / gridNumWidth),
                thumbY = 10 + gap;
            for (var j = 0; j < thumbsAbove; j++) {
                var curThumbAbove = gridNumWidth * (j + 1);
                thumbY += Util.getStyle(thumbs[i - curThumbAbove], 'height') + gap;
            }
            return thumbY;
        }
        window.Thumbnails = Thumbnails;
    }(window));

    (function (window) {
        Scroll.scrollBars = [];
        Scroll.vendors = ['WebkitT', 'MozT', 'OT', 'MST', 't'];

        function Scroll(obj, mask, vars) {
            this.obj = obj;
            this.obj.scrollbar = true;
            this.mask = mask;
            this.align = 'left';
            this.vAlign = 'top';
            this.color = '#545454';
            this.hover = '#A9A9A9';
            this.hOffset = 0;
            this.vOffset = 0;
            this.width = 6;
            this.topPad = 0;
            this.bottomPad = 0;
            for (key in vars) this[key] = vars[key];
            if (this.mask.parentNode.back) this.mask.parentNode.removeChild(this.mask.parentNode.back);
            this.rgb = Util.hexToRGB(this.color);
            this.mask.left = Util.getStyle(this.mask, 'left') ? Util.getStyle(this.mask, 'left') : 0;
            this.mask.width = Util.getStyle(this.mask, 'width');
            this.mask.height = Util.getStyle(this.mask, 'height');
            switch (this.vAlign) {
                case 'top':
                    this.mask.top = Util.getStyle(this.mask, 'top') ? Util.getStyle(this.mask, 'top') : 0;
                    this.obj.height = this.topPad + Util.getStyle(this.obj, 'height') + this.bottomPad;
                    new CSSTween(this.obj, [this.topPad + 'px'], ['top 0s ease-out'], '', false);
                    break;
                case 'center':
                    this.mask.top = Util.getStyle(this.mask, 'top') ? Util.getStyle(this.mask, 'top') : 0;
                    this.obj.height = this.topPad + Util.getStyle(this.obj, 'height') + this.bottomPad;
                    new CSSTween(this.obj, [this.topPad + 'px'], ['top 0s ease-out'], '', false);
                    break;
                case 'bottom':
                    this.mask.bottom = Util.getStyle(this.mask, 'bottom') ? Util.getStyle(this.mask, 'bottom') : 0;
                    this.obj.height = this.topPad + Util.getStyle(this.obj, 'height') + this.bottomPad;
                    new CSSTween(this.obj, [this.bottomPad + 'px'], ['bottom 0s ease-out'], '', false);
                    break;
            }
            Scroll.scrollBars.push(this);
            this.setEventTypes = function () {
                "ontouchstart" in window ? this.touchDevice = true : this.touchDevice = false;
                if (this.touchDevice) {
                    Scroll.DOWN = 'touchstart';
                    Scroll.MOVE = 'touchmove';
                    Scroll.UP = 'touchend';
                    Scroll.OUT = 'touchcancel';
                } else {
                    Scroll.DOWN = 'mousedown';
                    Scroll.MOVE = 'mousemove';
                    Scroll.UP = 'mouseup';
                    Scroll.OUT = 'mouseout';
                }
            };
            this.build = function () {
                var scrollDivHeight = this.topPad + Util.getStyle(this.obj, 'height') + this.bottomPad;
                this.back = document.createElement('div');
                this.back.setAttribute('class', 'scrollBg');
                this.back.style.position = 'absolute';
                this.back.style.zIndex = 150;
                if (this.vAlign === 'top' || this.vAlign === 'center') {
                    this.back.style.top = this.mask.top + this.vOffset + 0 + 'px';
                } else {
                    this.back.style.bottom = this.mask.bottom + this.vOffset + 0 + 'px';
                }
                this.back.style.width = this.width + 'px';
                this.back.style.height = this.mask.height + 'px';
                this.back.style.backgroundColor = "rgba(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + "," + .35 + ")";
                this.mask.parentNode.appendChild(this.back);
                this.handle = document.createElement('div');
                this.handle.setAttribute('class', 'scrollHandle');
                this.handle.style.position = 'absolute';
                this.handle.style.width = this.width + 'px';
                this.handle.style.height = (this.mask.height / this.obj.height) * this.mask.height + 'px';
                switch (this.vAlign) {
                    case 'top':
                        this.handle.style.top = 0 + 'px';
                        break;
                    case 'center':
                        this.handle.style.top = 0 + 'px';
                        break;
                    case 'bottom':
                        this.handle.style.bottom = 0 + 'px';
                        break;
                }
                this.handle.style.backgroundColor = this.color;
                this.handle.style.opacity = 1;
                this.back.appendChild(this.handle);
                this.percent = 0;
                this.scrollbar = this.back;
                this.handle.instance = this;
                this.back.instance = this;
                this.obj.instance = this;
                this.obj.hasScrollbar = true;
                Scroll.active = this;
                Scroll.active.scrolling = false;
                this.checkScrollVisible();
                Scroll.resize(); /** mouseover to select active scroll instance*/
                this.obj.addEventListener(MOUSE_OVER, this.selectActive, false); /** mouse events for scroll handle*/
                this.handle.addEventListener(MOUSE_OVER, this.mouseOver, false);
                this.handle.addEventListener(MOUSE_OUT, this.mouseOut, false);
                this.handle.addEventListener(MOUSE_DOWN, this.mouseDown, false); /** touch events for scroll handle*/
                this.handle.addEventListener(TOUCH_START, this.mouseDown, false);
                this.handle.addEventListener(TOUCH_END, this.mouseOut, false);
                this.handle.addEventListener(TOUCH_CANCEL, this.mouseOut, false); /** i dont like this*/
                if (this.obj.mediaItem) {
                    this.obj.mediaItem.instance = this;
                    this.obj.mediaItem.addEventListener(TOUCH_START, this.touchStart, false);
                    this.obj.mediaItem.addEventListener(TOUCH_END, this.touchEnd, false);
                    this.obj.mediaItem.addEventListener(TOUCH_CANCEL, this.touchEnd, false);
                } else if (this.name !== 'menu') {
                    this.obj.instance = this;
                    this.obj.addEventListener(TOUCH_START, this.touchStart, false);
                    this.obj.addEventListener(TOUCH_END, this.touchEnd, false);
                    this.obj.addEventListener(TOUCH_CANCEL, this.touchEnd, false);
                }
                window.addEventListener('MozMousePixelScroll', Scroll.mouseScroll, false);
                document.onmousewheel = Scroll.mouseScroll;
            };
            this.mouseOver = function (event) {
                Scroll.active = this.instance;
                new CSSTween(event.target, [this.instance.hover], ['background-color .35s cubic'], '', true);
                if (Firefox) event.target.style.backgroundColor = this.instance.hover;
            };
            this.mouseOut = function (event) {
                if (!this.instance.drag) new CSSTween(event.target, [this.instance.color], ['background-color .35s cubic'], '', true);
                if (!this.instance.drag && Firefox) event.target.style.backgroundColor = this.instance.color;
            };
            this.mouseDown = function (event) {
                event.preventDefault();
                new CSSTween(event.target, [this.instance.hover], ['background-color .35s cubic'], '', true);
                if (Firefox) event.target.style.backgroundColor = this.instance.hover;
                this.instance.drag = true;
                switch (this.instance.vAlign) {
                    case 'top':
                        this.instance.startPoint = this.instance.getYaxis(event) - Util.getStyle(Scroll.active.back, 'top') - Util.getStyle(event.target, 'top');
                        break;
                    case 'center':
                        this.instance.startPoint = this.instance.getYaxis(event) - Util.getStyle(Scroll.active.back, 'top') - Util.getStyle(event.target, 'top');
                        break;
                    case 'bottom':
                        this.instance.startPoint = this.instance.getYaxis(event) - Util.getStyle(Scroll.active.back, 'bottom') - Util.getStyle(event.target, 'bottom');
                        break;
                }
                document.addEventListener(MOUSE_MOVE, this.instance.mouseMove, false);
                document.addEventListener(MOUSE_UP, this.instance.mouseUp, false);
                document.addEventListener(TOUCH_MOVE, this.instance.mouseMove, false);
                document.addEventListener(TOUCH_END, this.instance.mouseUp, false);
            };
            this.mouseUp = function (event) {
                new CSSTween(Scroll.active.handle, [Scroll.active.color], ['background-color .35s cubic'], '', true);
                Scroll.active.drag = false;
                Scroll.active.scrolling = false;
                document.removeEventListener(MOUSE_MOVE, Scroll.active.mouseMove, false);
                document.removeEventListener(MOUSE_UP, Scroll.active.mouseUp, false);
                document.removeEventListener(TOUCH_MOVE, Scroll.active.mouseMove, false);
                document.removeEventListener(TOUCH_END, Scroll.active.mouseUp, false);
                if (Firefox) Scroll.active.handle.style.backgroundColor = Scroll.active.color;
            };
            this.mouseMove = function (event) {
                switch (Scroll.active.vAlign) {
                    case 'top':
                        if (Scroll.active.drag) Scroll.active.update(Scroll.active.getYaxis(event) - Scroll.active.startPoint - Util.getStyle(Scroll.active.back, 'top'));
                        break;
                    case 'center':
                        if (Scroll.active.drag) Scroll.active.update(Scroll.active.getYaxis(event) - Scroll.active.startPoint - Util.getStyle(Scroll.active.back, 'top'));
                        break;
                    case 'bottom':
                        if (Scroll.active.drag) Scroll.active.update(Scroll.active.getYaxis(event) - Scroll.active.startPoint - Util.getStyle(Scroll.active.back, 'bottom'));
                        break;
                }
            };
            this.update = function (handlePosition) {
                if (handlePosition < 0) {
                    handlePosition = 0;
                } else if (handlePosition > Util.getStyle(this.back, 'height') - Util.getStyle(this.handle, 'height')) {
                    handlePosition = Util.getStyle(this.back, 'height') - Util.getStyle(this.handle, 'height');
                }
                this.percent = Scroll.getPercent(handlePosition, Util.getStyle(this.back, 'height') - Util.getStyle(this.handle, 'height'));
                switch (this.vAlign) {
                    case 'top':
                        this.handle.style.top = handlePosition + 'px';
                        break;
                    case 'center':
                        this.handle.style.top = handlePosition + 'px';
                        break;
                    case 'bottom':
                        this.handle.style.bottom = handlePosition + 'px';
                        break;
                }
                Scroll.active.setScrollPosition();
                Scroll.active.scrolling = true;
            };
            this.selectActive = function (event) {
                Scroll.active = this.instance;
            };
            this.touchStart = function (event) {
                event.preventDefault();
                Scroll.active = this.instance;
                this.instance.drag = true;
                this.instance.start = this.instance.getYaxis(event);
                switch (this.instance.vAlign) {
                    case 'top':
                        this.instance.startPoint = this.instance.getYaxis(event) - Util.getStyle(Scroll.active.mask, 'top') - Util.getStyle(this.instance.obj, 'top') + this.instance.topPad;
                        break;
                    case 'center':
                        this.instance.startPoint = this.instance.getYaxis(event) - Util.getStyle(Scroll.active.mask, 'top') - Util.getStyle(this.instance.obj, 'top') + this.instance.topPad;
                        break;
                    case 'bottom':
                        this.instance.startPoint = this.instance.getYaxis(event) - Util.getStyle(Scroll.active.mask, 'bottom') - Util.getStyle(this.instance.obj, 'bottom') + this.instance.bottomPad;
                        break;
                }
                this.instance.obj.addEventListener(TOUCH_MOVE, this.instance.touchMove, false);
                this.instance.obj.addEventListener(TOUCH_END, this.instance.touchEnd, false);
            };
            this.touchMove = function (event) {
                switch (Scroll.active.vAlign) {
                    case 'top':
                        if (Scroll.active.drag) Scroll.active.touchUpdate(Scroll.active.getYaxis(event) - Scroll.active.startPoint - Util.getStyle(Scroll.active.mask, 'top'));
                        break;
                    case 'center':
                        if (Scroll.active.drag) Scroll.active.touchUpdate(Scroll.active.getYaxis(event) - Scroll.active.startPoint - Util.getStyle(Scroll.active.mask, 'top'));
                        break;
                    case 'bottom':
                        if (Scroll.active.drag) Scroll.active.touchUpdate(Scroll.active.getYaxis(event) - Scroll.active.startPoint - Util.getStyle(Scroll.active.mask, 'bottom'));
                        break;
                } /*if(!Site.curMediaItem.touchNavlisteners){Scroll.active.start - Scroll.active.getYaxis(event)>0?TouchNav.swipeDirection='up' :TouchNav.swipeDirection='down';}*/
            };
            this.getYaxis = function (event) {
                switch (this.vAlign) {
                    case 'top':
                        return this.touchDevice ? event.touches[0].pageY : event.clientY;
                        break;
                    case 'center':
                        return this.touchDevice ? event.touches[0].pageY : event.clientY;
                        break;
                    case 'bottom':
                        return -(this.touchDevice ? event.touches[0].pageY : event.clientY);
                        break;
                }
            };
            this.touchUpdate = function (position) {
                position = -position;
                var totalScrollableHeight = this.topPad + Util.getStyle(this.obj, 'height') + this.bottomPad;
                this.percent = Scroll.getPercent(position, totalScrollableHeight - Util.getStyle(this.mask, 'height'));
                Scroll.active.setHandlePosition();
                Scroll.active.setScrollPosition();
                Scroll.active.scrolling = true;
                if (POD) Menu.buttonPos();
            };
            this.touchEnd = function (event) {
                Scroll.active.drag = false;
                Scroll.active.setScrollRebound();
                document.removeEventListener(Scroll.MOVE, Scroll.active.mouseMove, false);
                document.removeEventListener(Scroll.UP, Scroll.active.mouseUp, false);
                setTimeout(function () {
                    if (TouchNav.swipeDirection != 'left' && TouchNav.swipeDirection != 'right') {
                        TouchNav.swipeDirection = undefined;
                    }
                    if (POD) Menu.buttonPos();
                    Scroll.active.scrolling = false;
                }, 250);
            };
            this.setScrollPosition = function () {
                var totalScrollableHeight = this.topPad + Util.getStyle(this.obj, 'height') + this.bottomPad;
                var top = -Scroll.getPosition(this.percent, totalScrollableHeight - Util.getStyle(this.back, 'height'));
                switch (this.vAlign) {
                    case 'top':
                        if (POD || PAD || BROWSER_NAME === 'MSIE') {
                            this.obj.style.top = top + this.topPad + 'px';
                        } else {
                            this.xform(this.obj, 'translateY', top + 'px');
                        }
                        break;
                    case 'center':
                        if (POD || PAD || BROWSER_NAME === 'MSIE') {
                            this.obj.style.top = top + 'px';
                        } else {
                            this.xform(this.obj, 'translateY', top + 'px');
                        }
                        break;
                    case 'bottom':
                        if (POD) {
                            this.obj.style.top = top + 'px';
                        } else if (PAD || BROWSER_NAME === 'MSIE') {
                            this.obj.style.bottom = top + this.bottomPad + 'px';
                        } else {
                            this.xform(this.obj, 'translateY', -top + 'px');
                        }
                        break;
                }
            };
            this.xform = function (obj, prop, val) {
                for (i in Transition.vendors) obj.style[Transition.vendors[i] + 'ransform'] = prop + '(' + val + ')';
            };
            this.checkPercentBound = function () {
                if (this.percent < 0) {
                    this.percent = 0;
                } else if (this.percent > 1) {
                    this.percent = 1;
                }
            };
            this.setScrollRebound = function () {
                Scroll.active.checkPercentBound();
                var totalScrollableHeight = this.topPad + Util.getStyle(this.obj, 'height') + this.bottomPad;
                var top = -Scroll.getPosition(this.percent, totalScrollableHeight - Util.getStyle(this.back, 'height'));
                new CSSTween(this.obj, [this.topPad + top + 'px'], ['top 0s ease-out'], '', false);
            };
            this.setHandlePosition = function () {
                var percent, top;
                if (this.percent < 0) {
                    percent = 0;
                } else if (this.percent > 1) {
                    percent = 1;
                } else {
                    percent = this.percent;
                }
                top = Scroll.getPosition(percent, Util.getStyle(this.back, 'height') - Util.getStyle(this.handle, 'height'));
                switch (this.vAlign) {
                    case 'top':
                        new CSSTween(this.handle, [top + 'px'], ['top 0s ease-out'], '', false);
                        break;
                    case 'center':
                        new CSSTween(this.handle, [top + 'px'], ['top 0s ease-out'], '', false);
                        break;
                    case 'bottom':
                        new CSSTween(this.handle, [top + 'px'], ['bottom 0s ease-out'], '', false);
                        break;
                }
            };
            this.checkScrollVisible = function () {
                var totalScrollableHeight = this.topPad + Util.getStyle(this.obj, 'height') + this.bottomPad;
                if (totalScrollableHeight > Util.getStyle(this.mask, 'height') && Util.getStyle(this.mask, 'opacity') > 0) {
                    this.back.style.display = 'block';
                    this.back.style.opacity = 1;
                    this.scrollable = true;
                    this.mask.style.overflow = 'hidden';
                } else {
                    this.back.style.opacity = 0;
                    this.back.style.display = 'none';
                    this.percent = 0;
                    this.scrollable = false;
                    this.mask.style.overflow = 'visible';
                }
            };
            this.setEventTypes();
            this.build();
        }
        Scroll.mouseScroll = function (event) {
            if (Scroll.active.scrollable) {
                var scrollY = 0;
                if (event.detail && event.axis == 2) {
                    scrollY = event.detail;
                } else if (event.wheelDeltaY) {
                    scrollY = -event.wheelDeltaY;
                } else if (event.wheelDelta) {
                    scrollY = -event.wheelDelta * 2;
                }
                if (Scroll.active.vAlign == 'bottom') {
                    scrollY = scrollY * -1;
                }
                var newPosition = Scroll.active.percent + (scrollY * .0001);
                if (newPosition < 0) {
                    Scroll.active.percent = 0;
                } else if (newPosition > 0 && newPosition < 1) {
                    Scroll.active.percent = newPosition;
                } else if (newPosition > 1) {
                    Scroll.active.percent = 1;
                }
                Scroll.active.setHandlePosition();
                Scroll.active.setScrollPosition();
            }
        };
        Scroll.getPercent = function (position, totalScrollableHeight) {
            return position / totalScrollableHeight;
        };
        Scroll.getPosition = function (percent, totalScrollableHeight) {
            return percent * totalScrollableHeight;
        };
        Scroll.resize = function () {
            var i = Scroll.scrollBars.length;
            while (i--) {
                var ths = Scroll.scrollBars[i];
                var totalScrollableHeight = ths.topPad + Util.getStyle(ths.obj, 'height') + ths.bottomPad;
                ths.checkScrollVisible();
                if (ths.align == 'right') {
                    ths.back.style.left = (ths.mask.left + Util.getStyle(ths.mask, 'width') - ths.width + ths.hOffset) + 'px';
                } else {
                    ths.back.style.left = (ths.mask.left - ths.hOffset) + 'px';
                }
                if (ths.vAlign == 'center') {
                    ths.back.style.top = Util.getStyle(ths.mask, 'top') + ths.vOffset + 0 + 'px';
                }
                ths.back.style.height = Util.getStyle(ths.mask, 'height') + 'px';
                ths.handle.style.height = ((Util.getStyle(ths.mask, 'height') / totalScrollableHeight) * Util.getStyle(ths.mask, 'height')) + 'px';
                ths.setHandlePosition();
                ths.setScrollPosition();
            }
        };
        window.Scroll = Scroll;
    }(window));

    (function (window) {
        ScrollCursor.instances = [];
        ScrollCursor.vendors = ['WebkitT', 'MozT', 'OT', 't'];

        function ScrollCursor(obj, mask, vars) {
            this.obj = obj, this.obj.scroll = true, this.mask = mask;
            for (key in vars) this[key] = vars[key];
            this.obj.parent = this;
            this.mask.parent = this;
            this.mousePercent = 0;
            this.yGoal = 0;
            this.obj.style.position = 'absolute';
            this.xtion = function (obj, val) {
                for (i in Transition.vendors) obj.style[Transition.vendors[i] + 'ransition'] = val;
            };
            this.xform = function (obj, prop, val) {
                for (i in Transition.vendors) obj.style[Transition.vendors[i] + 'ransform'] = prop + '(' + val + ')';
            };
            this.xtion(this.obj, 'all 1.8s ease-out');
            ScrollCursor.instances.push(this);
            ScrollCursor.active = this;
            this.update = function (event) {
                var ths = ScrollCursor.active;
                if (ths.obj.height + (50 * 2) > ths.mask.height && event.pageX > ths.mask.left && event.pageX < ths.mask.left + ths.mask.width && event.pageY > ths.mask.top && event.pageY < ths.mask.top + ths.mask.height) {
                    var mouseY = event.pageY - ths.mask.top;
                    ths.mousePercent = (mouseY / ths.mask.height);
                    if (mouseY / ths.mask.height < .1) {
                        ths.mousePercent = 0;
                    } else if (mouseY / ths.mask.height > .9) {
                        ths.mousePercent = 1;
                    }
                    ths.yGoal = ((ths.mask.height) - (ths.obj.height + (50 * 2))) * ths.mousePercent;
                } else if (ths.obj.height < ths.mask.height) {
                    ths.yGoal = 0;
                } else {
                    ths.yGoal = ((ths.mask.height) - (ths.obj.height + (50 * 2))) * ths.mousePercent;
                }
                ths.setPos();
            };
            this.setPos = function () {
                var ths = ScrollCursor.active;
                if ((Chrome || Firefox || Safari) && Thumbnails.loading) {
                    ths.xform(ths.obj, 'translateZ', 0);
                    ths.obj.style.top = ths.yGoal + 50 + 'px';
                } else if (Chrome || Firefox || Opera) {
                    ths.yGoal -= Util.getStyle(ths.obj, 'top') - 50;
                    ths.xtion(ths.obj, 'all .7s ease-out');
                    ths.xform(ths.obj, 'translateY', ths.yGoal + 'px');
                } else if (Safari) {
                    ths.xform(ths.obj, 'translateZ', 0);
                    ths.xtion(ths.obj, 'all 1s cubic-bezier(0.350,0.405,0.415,0.995)');
                    ths.obj.style.top = ths.yGoal + 50 + 'px';
                } else {
                    ths.xform(ths.obj, 'translateZ', 0);
                    ths.obj.style.top = ths.yGoal + 50 + 'px';
                }
            };
            document.addEventListener('mousemove', this.update, false);
            ScrollCursor.resize();
        }
        ScrollCursor.resize = function () {
            var ths = ScrollCursor.active;
            ths.mask.left = Util.getStyle(ths.mask, 'left') ? Util.getStyle(ths.mask, 'left') : 0;
            ths.mask.top = Util.getStyle(ths.mask, 'top') ? Util.getStyle(ths.mask, 'top') : 0;
            ths.mask.width = Util.getStyle(ths.mask, 'width');
            ths.mask.height = Util.getStyle(ths.mask, 'height');
        };
        window.ScrollCursor = ScrollCursor;
    }(window));

    (function (window) {
        Caption.defaultOn = false;
        Caption.state = undefined;

        function Caption() {}
        Caption.resize = function () {
            if (Site.curMediaItem && Site.curMediaItem.getElementsByTagName('cite')[0]) {
                var cap = Site.curMediaItem.getElementsByTagName('cite')[0];
                cap.style.display = 'block';
                cap.style.position = 'absolute';
                var capWidth = parseInt(window.getComputedStyle(cap).getPropertyValue("width"));
                var left = ((STAGE_WIDTH - capWidth) * 0.5) - 8;
                if (PAD || POD) {
                    var bottom = 33;
                    new CSSTween(cap, [left + 'px', bottom + 'px'], ['left 0s cubic', 'bottom 0s cubic']);
                } else {
                    var bottom = 100 > 0 ? 10 : 33;
                    new CSSTween(cap, [left + 'px', bottom + 'px'], ['left 0s cubic', 'bottom 0s cubic']);
                }
            }
        };
        Caption.getCur = function () {
            try {
                return Site.curMediaItem.getElementsByTagName('cite')[0];
            } catch (error) {}
        };
        Caption.on = function () {
            if (Site.curMediaItem && Site.curMediaItem.getElementsByTagName('cite')[0]) {
                Caption.state = true;
                Caption.resize();
                setTimeout(Caption.resize, 10);
                setTimeout(function () {
                    var cap = Site.curMediaItem.getElementsByTagName('cite')[0];
                    cap.style.opacity = 1;
                }, 20);
            }
        };
        Caption.off = function () {
            if (Site.curMediaItem && Site.curMediaItem.getElementsByTagName('cite')[0]) {
                var cap = Site.curMediaItem.getElementsByTagName('cite')[0];
                new CSSTween(cap, [0], ['opacity 0s cubic']);
                Caption.state = false;
            }
        };
        Caption.toggle = function () {
            if (Caption.state) {
                Caption.state = false;
                Address.setPath(Site.curPath + "/" + Site.curImgNum);
            } else {
                Caption.state = true;
                Address.setPath(Site.curPath + "/" + Site.curImgNum + "/caption");
            }
        };
        Caption.check = function () {
            if (Address.getPath() !== '' && Caption.defaultOn && Caption.state == undefined && Site.curMediaItem && Site.curMediaItem.getElementsByTagName('cite')[0]) {
                Caption.on();
            } else if (Address.getPath() !== '' && Caption.state && Site.curMediaItem && Site.curMediaItem.getElementsByTagName('cite')[0]) {
                Caption.on();
            }
        };
        window.Caption = Caption;
    }(window));

    (function (window) {
        function Page() {}
        Page.resize = function (mediaItem) {
            if (POD) {
                var pageTopMargin = 26,
                    pageBottomMargin = 0,
                    pageLeftMargin = 16,
                    pageRightMargin = 0;
            } else {
                var pageTopMargin = Util.percentToPixels('100px', STAGE_HEIGHT),
                    pageBottomMargin = Util.percentToPixels('20px', STAGE_HEIGHT),
                    pageLeftMargin = Util.percentToPixels('10%', STAGE_WIDTH),
                    pageRightMargin = Util.percentToPixels('350', STAGE_WIDTH);
            }
            var scrollBarWidth = 6;
            var featuredImage;
            if (mediaItem.getAttribute('data-featuredImage')) {
                featuredImage = Site.getMediaAsset(mediaItem, 'featuredImage');
            }
            var mask = Site.getMediaAsset(mediaItem, 'textMask');
            mask.style.position = 'absolute';
            var headingHeight = 0;
            if (true && Site.state != CONTACT) {
                var heading = Site.getMediaAsset(mediaItem, 'textPage').getElementsByTagName('h2')[0];
                heading.style.position = 'absolute';
                heading.style.top = pageTopMargin + 'px';
                headingHeight = 18 + 30;
                mask.style.top = pageTopMargin + headingHeight + 'px';
                if ('left' == 'right' && featuredImage && !POD) {
                    heading.style.left = pageLeftMargin + featuredImage.width + 24 + 'px';
                } else if ('left' == 'right' && !featuredImage) {
                    heading.style.left = pageLeftMargin + 'px';
                } else if ('left' == 'left' && featuredImage && !POD) {
                    heading.style.left = pageLeftMargin + scrollBarWidth + 30 + featuredImage.width + 24 + 'px';
                } else {
                    heading.style.left = pageLeftMargin + 'px';
                }
            } else {
                mask.style.top = pageTopMargin + 'px';
            }
            if (featuredImage && !POD) {
                featuredImage.style.top = pageTopMargin + headingHeight + 'px';
            }
            if ('left' == 'left' && featuredImage && !POD) {
                mask.style.left = pageLeftMargin + 30 + featuredImage.width + 30 + 'px';
                if (!POD) featuredImage.style.left = pageLeftMargin + 'px';
            } else if ('left' == 'left' && !featuredImage) {
                mask.style.left = pageLeftMargin + 30 + 'px';
            } else if ('left' == 'right' && featuredImage && !POD) {
                mask.style.left = pageLeftMargin + featuredImage.width + 30 + 'px';
                if (!POD) featuredImage.style.left = pageLeftMargin + 'px';
            } else {
                mask.style.left = pageLeftMargin + 'px';
            }
            var text;
            if (Site.state == CONTACT) {
                text = Site.getMediaAsset(mediaItem, 'contactForm');
            } else {
                text = Site.getMediaAsset(mediaItem, 'pageText');
            }
            var maskWidth;
            if (featuredImage && !POD) {
                maskWidth = (STAGE_WIDTH - (pageLeftMargin + pageRightMargin + 30 + featuredImage.width + 30));
            } else {
                maskWidth = (STAGE_WIDTH - (pageLeftMargin + pageRightMargin + 30));
            }
            var maskHeight = (STAGE_HEIGHT - (pageTopMargin + pageBottomMargin + headingHeight));
            mask.style.width = maskWidth + 'px';
            mask.style.height = maskHeight + 'px';
            if (!mediaItem.scrollbar && (Util.getStyle(text, 'height') > maskHeight)) {
                switch ('left') {
                    case 'left':
                        var horOffset = 30;
                        break;
                    case 'right':
                        var horOffset = 30 + 4;
                        break;
                }
                text.mediaItem = mediaItem;
                if (!mediaItem.scroll) mediaItem.scroll = new Scroll(text, mask, {
                        align: 'left',
                        hOffset: horOffset,
                        vOffset: 0
                    });
            }
            Scroll.resize();
            text.mediaItem = mediaItem;
            mask.mediaItem = mediaItem;
        };
        Page.linkTouchEvents = function (mediaItem) {
            var a = mediaItem.getElementsByTagName('a');
            for (i in a) {
                if (a[i].href != undefined && a[i].href != '') {
                    a[i].addEventListener(TOUCH_END, Page.touchLink, false);
                }
            }
        };
        Page.touchLink = function (e) {
            var tg = '';
            if (!e.target.getAttribute('onclick')) tg = '_blank';
            if (e.target.getAttribute('target')) tg = e.target.getAttribute('target');
            if (e.target.href.search('mailto:') > -1) {
                if (e.target.href) {
                    window.location.href = e.target.href;
                } else if (e.target.parentNode.href) {
                    window.location.href = e.target.parentNode.href;
                }
            } else if (tg === '_blank' || tg === '_self') {
                if (e.target.href) {
                    window.open(e.target.href, tg);
                } else if (e.target.parentNode.href) {
                    window.open(e.target.parentNode.href, tg);
                }
            } else {
                if (e.target.href) {
                    Address.setPath(e.target.href.split(window.location.hostname)[1]);
                } else if (e.target.parentNode.href) {
                    Address.setPath(e.target.parentNode.href.split(window.location.hostname)[1]);
                }
            }
        };
        window.Page = Page;
    }(window));
    
	
	
	(function (window) {
	    Transition.active = false;
	    Transition.zIndex = 0;
	    Transition.dir = 'left';
	    Transition.vendors = ['WebkitT', 'MozT', 'OT', 't'];
	
	    function Transition(_new, vars) {
	        this._new = _new;
	        this.speed = Transition.speed();
	        this.type = 'fade';
	        for (key in vars) this[key] = vars[key];
	        this.transition = function () {
	            switch (this.type) {
	                case 'slide':
	                    this.slide();
	                    break;
	                case 'fade':
	                    this.fade();
	                    break;
	            }
	        };
	        this.fade = function () {
	            if (this.old != this._new) {
	                Transition.active = true;
	                this._new.style.zIndex = Transition.zIndex++;
	                this._new.style.left = 0 + 'px';
	                this.xtion(this._new, '');
	                this.xform(this._new, 'translateX', 0 + 'px');
	                new CSSTween(this._new, [1], ['opacity ' + this.speed + 's cubic'], function () {
	                    Transition.active = false;
	                });
	                if (this.old) {
	                    var ths = this;
	                    new CSSTween(this.old, [0], ['opacity ' + this.speed + 's cubic'], function () {
	                        var swiping = Site.touchNav ? TouchNav.swiping : false;
	                        if (ths.onComplete) ths.onComplete();
	                    });
	                }
	            } else {
	                this._new.style.left = 0 + 'px';
	                this._new.style.opacity = 1;
	                this.xtion(this._new, '');
	                this.xform(this._new, 'translateX', 0 + 'px');
	            }
	        };
	        this.xtion = function (obj, val) {
	            for (i in Transition.vendors) obj.style[Transition.vendors[i] + 'ransition'] = val;
	        };
	        this.xform = function (obj, prop, val) {
	            if (obj.getAttribute('data-content') && obj.getAttribute('data-content').search("vimeo:") === 0 && BROWSER_NAME === 'Firefox') {
	                for (i in Transition.vendors) obj.style.left = val;
	            } else {
	                for (i in Transition.vendors) obj.style[Transition.vendors[i] + 'ransform'] = prop + '(' + val + ')';
	            }
	        };
	        this.slide = function () {
	            if (Address.getPath() != '' && this.old && this.old != this._new) {
	                Transition.active = true;
	                this._new.style.zIndex = Transition.zIndex++;
	                var newTo, oldTo;
	                switch (Transition.dir) {
	                    case 'left':
	                        if (this.old) {
	                            this.xtion(this.old, '');
	                            this.xform(this.old, 'translateX', 0 + 'px');
	                        }
	                        this.xtion(this._new, '');
	                        this.xform(this._new, 'translateX', STAGE_WIDTH + 'px');
	                        newTo = 0;
	                        oldTo = -STAGE_WIDTH;
	                        break;
	                    case 'right':
	                        if (this.old) {
	                            this.xtion(this.old, '');
	                            this.xform(this.old, 'translateX', 0 + 'px');
	                        }
	                        this.xtion(this._new, '');
	                        this.xform(this._new, 'translateX', (-STAGE_WIDTH) + 'px');
	                        newTo = 0;
	                        oldTo = STAGE_WIDTH;
	                        break;
	                }
	                var ths = this;
	                setTimeout(function () {
	                    if (ths.onComplete) ths.onComplete();
	                    Transition.active = false;
	                }, ths.speed * 1000);
	                setTimeout(function () {
	                    ths._new.style.display = 'block';
	                    ths._new.style.opacity = 1;
	                    ths._new.parent = ths;
	                    ths.xtion(ths._new, 'all ' + ths.speed + 's');
	                    ths.xform(ths._new, 'translateX', newTo + 'px');
	                    if (ths.old) {
	                        ths.xtion(ths.old, 'all ' + ths.speed + 's');
	                        ths.xform(ths.old, 'translateX', oldTo + 'px');
	                        setTimeout(function () {
	                            ths.old.style.opacity = 0;
	                            ths.old.style.display = 'none';
	                        }, ths.speed * 800);
	                    }
	                }, 50);
	            } else {
	                this.fade();
	            }
	        };
	        this.transition();
	    }
	    Transition.setDir = function (dir) {
	        switch (dir) {
	            case 'left':
	                Transition.dir = 'left';
	                break;
	            case 'right':
	                Transition.dir = 'right';
	                setTimeout(function () {
	                    Transition.setDir('left')
	                }, 250);
	                break;
	        }
	    };
	    Transition.speed = function () {
	        if (Address.getPath() == '') {
	            return 1;
	        } else {
	            return 1;
	        }
	    };
	    window.Transition = Transition;
	}(window));
	
	var JSONP = function JSONP(vars) {
	    var jsonp = document.createElement("script"),
	        head = document.getElementsByTagName("head")[0];
	    jsonp.setAttribute("src", vars.url + "?" + vars.params + '&callback=' + vars.callback);
	    jsonp.setAttribute("id", "jsonp");
	    var id = document.getElementById("jsonp");
	    if (!id) {
	        head.appendChild(jsonp);
	    } else {
	        head.replaceChild(jsonp, id);
	    }
	};
	
	(function (window) {
	    Pass.width = 296;
	    Pass.height = 47;
	
	    function Pass() {}
	    Pass.show = function (section) {
	        Pass.section = section;
	        var id = section.getAttribute('data-lock');
	        if (!Pass.div) {
	            var p = document.createElement('div');
	            p.style.opacity = 0;
	            p.style.zIndex = 100;
	            p.setAttribute('id', 'passPop');
	            p.style.position = 'absolute';
	            p.style.display = 'none';
	            p.style.width = Pass.width + 'px';
	            p.style.height = Pass.height + 'px';
	            p.style.backgroundColor = '#ffffff';
	            d.site.appendChild(p);
	            Pass.div = p;
	        }
	        Pass.div.innerHTML = "<form name=sectionAuth>";
	        Pass.div.innerHTML += "<input id=passInput name=passInput onfocus='Share.focus(this)' onblur='Share.blur(this)' value='PASSWORD' data-default='PASSWORD' onkeydown='Pass.submitCheck(event," + id + ")' />";
	        Pass.div.innerHTML += "<input type=button value='SUBMIT' onfocus='Share.focus(this)' onblur='Share.blur(this)' onclick='Pass.submit(" + id + ")'>";
	        Pass.div.innerHTML += "</form>";
	        if (!Pass.showing) document.getElementById('passInput').value = 'PASSWORD';
	        Pass.showing = true;
	        Pass.align();
	        new CSSTween(Pass.div, [.95], ['opacity .35s cubic']);
	    };
	    Pass.align = function () {
	        if (Pass.div && !POD && !PAD) {
	            var STAGE_WIDTH = window.innerWidth - (60 + 25);
	            var STAGE_HEIGHT = window.innerHeight - (50 + 100);
	            Pass.div.style.left = ((STAGE_WIDTH - Pass.width + Util.getStyle(d.mediaView, 'left')) * 0.5) + 'px';
	            Pass.div.style.top = ((STAGE_HEIGHT - Pass.height) * 0.5) + 50 + window.pageYOffset + 'px';
	        } else if (Pass.div && (POD || PAD)) {
	            Pass.div.style.left = ((window.innerWidth - Pass.width) * 0.5) + 'px';
	            Pass.div.style.top = ((window.innerHeight - Pass.height) * 0.5) + window.pageYOffset + 'px';
	        }
	    };
	    Pass.checkLock = function (section) {
	        if (section && section.getAttribute('data-lock') && section.locked === false) {
	            section.locked = false;
	        } else if (section && section.getAttribute('data-lock') && section.locked === undefined) {
	            section.locked = true;
	        } else if (section && !section.getAttribute('data-lock')) {
	            section.locked = false;
	        }
	    };
	    Pass.hide = function () {
	        if (Pass.div) {
	            Pass.showing = false;
	            new CSSTween(Pass.div, [0], ['opacity .35s cubic']);
	        }
	    };
	    Pass.submitCheck = function (e, id) {
	        var keyPressed = e.which || e.keyCode;
	        if (keyPressed === 13) {
	            Pass.submit(id);
	            document.getElementById('passInput').blur();
	        }
	    };
	    Pass.submit = function (id) {
	        var pass = document.getElementById('passInput').value;
	        JSONP({
	            url: Address.base + 'inc/com/' + 'SectionAuth.php',
	            params: 'id=' + id + '&pass=' + pass,
	            callback: 'Pass.response'
	        });
	    };
	    Pass.response = function (response) {
	        if (response) {
	            Pass.section.locked = false;
	            Site.address();
	            Pass.hide();
	        } else {
	            document.getElementById('passInput').value = 'INCORRECT PASSWORD';
	        }
	    };
	    window.Pass = Pass;
	}(window));
	
	(function (window) {
	    Share.open = false;
	    Share.fontCol = Util.hexToRGB('#FFFFFF');
	    Share.fieldCol = Util.hexToRGB('#000000');
	
	    function Share() {
	        Share.build();
	    }
	    Share.setContactTouchEvents = function () {
	        var str = '';
	        var form = document.contact.elements;
	        for (key in form) {
	            if (form[key].id != undefined) {
	                form[key].addEventListener(TOUCH_END, Share.touchFocus, false);
	                form[key].addEventListener(TOUCH_CANCEL, Share.touchBlur, false);
	            }
	        }
	    };
	    Share.build = function () {
	        var shr = document.createElement('div');
	        shr.style.opacity = 0;
	        shr.style.zIndex = 28;
	        shr.style.position = 'absolute';
	        shr.style.display = 'none';
	        var shrLeft = 'left' == 'left' ? 60 + (275 - 34) : 60;
	        shr.style.left = shrLeft + 'px';
	        shr.style.top = 50 + 'px';
	        shr.style.overflow = 'hidden';
	        shr.setAttribute('class', 'share');
	        shr.bg = document.createElement('div');
	        shr.bg.style.position = 'absolute';
	        shr.bg.style.display = 'block';
	        shr.bg.style.overflow = 'hidden';
	        var rgb = Util.hexToRGB('#ffffff');
	        shr.bg.style.backgroundColor = "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + 1 + ")";
	        shr.appendChild(shr.bg);
	        shr.bg.addEventListener('click', Share.toggle, false);
	        shr.bg.gal = document.createElement('div');
	        shr.bg.gal.style.position = 'absolute';
	        shr.bg.gal.style.display = 'block';
	        shr.bg.gal.style.width = (STAGE_WIDTH - (50 * 2)) + 'px';
	        shr.bg.gal.style.height = 0 + 'px';
	        shr.bg.gal.height = 0;
	        shr.bg.gal.style.top = 50 + 'px';
	        shr.appendChild(shr.bg.gal);
	        shr.bg.gal.label = document.createElement('h3');
	        shr.bg.gal.label.style.position = 'relative';
	        shr.bg.gal.label.style.display = 'block';
	        shr.bg.gal.label.style.paddingBottom = 5 + 'px';
	        shr.bg.gal.label.innerHTML = "Email this image";
	        shr.bg.gal.appendChild(shr.bg.gal.label);
	        shr.bg.gal.line = document.createElement('hr');
	        shr.bg.gal.line.style.position = 'relative';
	        shr.bg.gal.line.style.width = (STAGE_WIDTH - (50 * 2)) + 'px';
	        shr.bg.gal.line.style.height = 1 + 'px';
	        shr.bg.gal.line.style.top = 0 + 'px';
	        shr.bg.gal.line.style.border = 0;
	        shr.bg.gal.line.style.opacity = .35;
	        shr.bg.gal.line.style.color = '#ff0000';
	        shr.bg.gal.line.style.backgroundColor = '#ff0000';
	        shr.bg.gal.appendChild(shr.bg.gal.line);
	        shr.bg.gal.form = document.createElement('div');
	        shr.bg.gal.form.style.position = 'absolute';
	        shr.bg.gal.form.setAttribute('id', 'emailForm');
	        shr.bg.gal.form.style.top = 45 + 'px';
	        shr.bg.gal.form.style.left = 208 + 'px';
	        var form = "<div id=shareResponse style='display:none;opacity:0;'></div>";
	        form += "<form name=emailShare class='emailShare'>";
	        form += "<div class='shareField'>";
	        form += "<div class='label'>YOUR NAME</div>";
	        form += "<input id='fromName' type='text' />";
	        form += "</div>";
	        form += "<div class='shareField'>";
	        form += "<div class='label'>FRIEND&apos;S NAME</div>";
	        form += "<input id='toName' type='text' />";
	        form += "</div>";
	        form += "<div class='shareField'>";
	        form += "<div class='label'>YOUR EMAIL</div>";
	        form += "<input id='fromEmail' type='text' />";
	        form += "</div>";
	        form += "<div class='shareField'>";
	        form += "<div class='label'>FRIEND&apos;S EMAIL</div>";
	        form += "<input id='toEmail' type='text' />";
	        form += "</div>";
	        form += "<div class='shareTextarea'>";
	        form += "<div class='label'>MESSAGE</div>";
	        form += "<textarea id='message'></textarea>";
	        form += "</div>";
	        form += "<input id=shareItem type=hidden value='" + encodeURIComponent(Address.base + 'media/thumb/' + '?w=1600&h=1200&f=' + Site.curMediaItem.getAttribute('data-thumb')) + "'>";
	        form += "<input type=button value='SEND' onclick='Share.shareForm()'>";
	        form += "</form>";
	        shr.bg.gal.form.innerHTML = form;
	        shr.bg.gal.appendChild(shr.bg.gal.form);
	        d.site.appendChild(shr);
	        Share.share = shr;
	        Site.share = shr;
	        Share.resize();
	        Share.styleForm();
	    };
	    Share.styleForm = function () {
	        var fields = document.emailShare.getElementsByTagName('input');
	        var i = fields.length;
	        while (i--) {
	            var focus = Share.contactfocus,
	                blur;
	            if (fields[i].type === 'button') {
	                focus = Site.submitfocus;
	                blur = Site.submitblur;
	            } else {
	                focus = Site.contactfocus;
	                blur = Site.contactblur;
	            }
	            blur.call(fields[i]);
	            fields[i].addEventListener('focus', focus, false);
	            fields[i].addEventListener('blur', blur, false);
	        }
	        var textarea = document.emailShare.getElementsByTagName('textarea');
	        if (textarea) {
	            Site.contactblur.call(textarea[0]);
	            textarea[0].addEventListener('focus', Site.contactfocus, false);
	            textarea[0].addEventListener('blur', Site.contactblur, false);
	        }
	    };
	    Share.imgLoad = function (event) {
	        var img = event.target;
	        img.style.opacity = 0;
	        if (RETINA) {
	            img.setAttribute('width', img.width * 0.5);
	            img.setAttribute('height', img.height * 0.5);
	        } else {
	            img.setAttribute('width', img.width);
	            img.setAttribute('height', img.height);
	        }
	        img.parent.appendChild(img);
	        new CSSTween(img, [1], ['opacity .25s cubic']);
	        img.removeEventListener('load', Share.imgLoad, false);
	    };
	    Share.update = function () {
	        var thumbQuery = RETINA ? Util.getThumbQuery(400, 266) : Util.getThumbQuery(200, 133);
	        var img = Site.share.bg.gal.img = document.createElement('img');
	        img.setAttribute('src', Address.base + 'media/thumb/' + Util.getThumbQuery(200, 133) + Site.curMediaItem.getAttribute('data-thumb'));
	        img.style.position = 'absolute';
	        img.style.top = 45 + 'px';
	        img.parent = Site.share.bg.gal;
	        img.addEventListener('load', Share.imgLoad, false);
	    };
	    Share.show = function () {
	        Share.update();
	        Site.resize();
	        new CSSTween(Site.share, [1], ['opacity .25s cubic']);
	        Share.open = true;
	    };
	    Share.hide = function () {
	        new CSSTween(Site.share, [0], ['opacity .25s cubic'], function () {
	            Site.share.bg.gal.removeChild(Site.share.bg.gal.img);
	            Site.share.style.display = 'none';
	        });
	        Share.open = false;
	    };
	    Share.toggle = function () {
	        if (Share.open) {
	            Address.setPath(Site.curPath + "/" + Site.curImgNum);
	        } else {
	            Address.setPath(Site.curPath + "/" + Site.curImgNum + "/email");
	        }
	    };
	    Share.resize = function () {
	        var emailWidth = 573,
	            emailHeight = 225;
	        Site.share.style.width = STAGE_WIDTH + 'px';
	        Site.share.style.height = STAGE_HEIGHT + 'px';
	        Site.share.bg.style.width = STAGE_WIDTH + 'px';
	        Site.share.bg.style.height = STAGE_HEIGHT + 'px';
	        Site.share.bg.gal.style.width = emailWidth + 'px';
	        Site.share.bg.gal.line.style.width = emailWidth + 'px';
	        Site.share.bg.gal.style.left = ((STAGE_WIDTH - emailWidth) * 0.5) + 'px';
	        Site.share.bg.gal.style.top = ((STAGE_HEIGHT - emailHeight) * 0.5) + 'px';
	        Scroll.resize();
	    };
	    Share.shareForm = function () {
	        var str = '';
	        var form = document.emailShare.elements;
	        for (key in form) {
	            if (form[key].id != undefined) {
	                form[key]._default = form[key].getAttribute('data-default');
	                str += '&' + form[key].id + '=' + form[key].value;
	            }
	        }
	        str = str.replace(/\n/g, "<br>");
	        str = str.replace(/\r/g, "<br>");
	        if (Share.checkShare() == '') {
	            JSONP({
	                url: Address.base + 'inc/com/' + 'Share.php',
	                params: 'method=shareForm' + str,
	                callback: 'Share.shareResponse'
	            });
	        } else {
	            alert(Share.checkShare());
	        }
	    };
	    Share.checkShare = function () {
	        var msg = '';
	        var form = document.emailShare.elements;
	        for (key in form) {
	            var id = form[key]._default;
	            var val = form[key].value;
	            if ((id == val || val == ' ') && id != undefined) {
	                msg += 'Please enter:' + id + '\n\r';
	            }
	        }
	        return msg;
	    };
	    Share.contactForm = function () {
	        var str = '';
	        var form = document.contact.elements;
	        for (key in form) {
	            if (form[key].id != undefined) {
	                str += '&' + form[key].id + '=' + form[key].value;
	            }
	        }
	        str = str.replace(/\n/g, "<br>");
	        str = str.replace(/\r/g, "<br>");
	        if (Share.checkForm() == '') {
	            JSONP({
	                url: Address.base + 'inc/com/' + 'Share.php',
	                params: 'method=contactForm' + str,
	                callback: 'Share.contactResponse'
	            });
	        } else {
	            alert(Share.checkForm());
	        }
	    };
	    Share.checkForm = function () {
	        var msg = '';
	        var form = document.contact.elements;
	        for (key in form) {
	            var id = String(form[key].id);
	            var val = String(form[key].value);
	            if (id == val && id.toLowerCase() != 'email' && id != 'undefined') {
	                msg += 'Please enter valid:' + id + '\n\r';
	            } else if (id.toLowerCase() == 'email') {
	                if (val.search('@') < 0 || val.search('.') < 0 || id == val) {
	                    msg += 'Please enter valid:' + id + '\n\r';
	                }
	            }
	        }
	        return msg;
	    };
	    Share.touchFocus = function (event) {
	        if (!TouchNav.swipeDirection) {
	            var rgb1 = Share.fieldCol;
	            event.target.style.backgroundColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + 0.5 + ")";
	            var rgb2 = Share.fontCol;
	            event.target.style.color = "rgba(" + rgb2.r + "," + rgb2.g + "," + rgb2.b + "," + 1 + ")";
	            if (event.target.getAttribute('data-default') === event.target.value) {
	                event.target.value = '';
	                event.target.focus();
	            }
	            if (event.target.value === 'Submit') {
	                Share.contactForm();
	            }
	        }
	        if (POD) Menu.buttonPos();
	    };
	    Share.touchBlur = function (event) {
	        if (!TouchNav.swipeDirection) {
	            var rgb1 = Share.fieldCol;
	            event.target.style.backgroundColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + 1 + ")";
	            var rgb2 = Share.fontCol;
	            event.target.style.color = "rgba(" + rgb2.r + "," + rgb2.g + "," + rgb2.b + "," + 1 + ")";
	            if (event.target.value === '') {
	                event.target.value = event.target.getAttribute('data-default');
	                event.target.blur();
	            }
	        }
	        if (POD) Menu.buttonPos();
	    };
	    Share.focus = function (input) {
	        var rgb1 = Share.fieldCol;
	        input.style.backgroundColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + 0.5 + ")";
	        var rgb2 = Share.fontCol;
	        input.style.color = "rgba(" + rgb2.r + "," + rgb2.g + "," + rgb2.b + "," + 1 + ")";
	        if (input.getAttribute('data-default') === input.value || input.value === 'INCORRECT PASSWORD') {
	            input.value = '';
	        }
	    };
	    Share.blur = function (input) {
	        var rgb1 = Share.fieldCol;
	        input.style.backgroundColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + 1 + ")";
	        var rgb2 = Share.fontCol;
	        input.style.color = "rgba(" + rgb2.r + "," + rgb2.g + "," + rgb2.b + "," + 1 + ")";
	        if (input.value === '' || input.value === 'INCORRECT PASSWORD') {
	            input.value = input.getAttribute('data-default');
	        }
	    };
	    Share.shareResponse = function (response) {
	        var rspDiv = document.getElementById('shareResponse');
	        rspDiv.style.opacity = 0;
	        rspDiv.style.position = 'absolute';
	        rspDiv.style.zIndex = 2;
	        rspDiv.style.width = '250px';
	        rspDiv.innerHTML = response;
	        rspDiv.innerHTML += "<br><input style='float:none;margin:10px 0;' type=button value='OK' onfocus='Share.focus(this)' onblur='Share.blur(this)' onclick='Share.toggle()'>";
	        new CSSTween(document.emailShare, [0], ['opacity .35s cubic'], function (ths) {
	            ths.style.display = 'none';
	        });
	        new CSSTween(rspDiv, [1], ['opacity 1s cubic']);
	    };
	    Share.contactResponse = function (response) {
	        var rspDiv = document.getElementById('contactResponse');
	        rspDiv.style.opacity = 0;
	        rspDiv.style.position = 'absolute';
	        rspDiv.style.zIndex = 2;
	        rspDiv.style.width = '350px';
	        rspDiv.innerHTML = response;
	        new CSSTween(document.contact, [0.001], ['opacity .35s cubic']);
	        new CSSTween(rspDiv, [1], ['opacity 1s cubic']);
	    };
	    window.Share = Share;
	}(window));
	
	(function (window) {
	    function ImgLoader() {}
	    ImgLoader.load = function (mediaItem) {
	        if (POD) {
	            ImgLoader.imageVideoMarginTop = 0, ImgLoader.imageVideoMarginRight = 0, ImgLoader.imageVideoMarginBottom = 0, ImgLoader.imageVideoMarginLeft = 0;
	        } else {
	            ImgLoader.imageVideoMarginTop = ImgLoader.percentToPixels('0', STAGE_HEIGHT), ImgLoader.imageVideoMarginRight = ImgLoader.percentToPixels('0', STAGE_WIDTH), ImgLoader.imageVideoMarginBottom = ImgLoader.percentToPixels('0', STAGE_HEIGHT), ImgLoader.imageVideoMarginLeft = ImgLoader.percentToPixels('150', STAGE_WIDTH);
	        }
	        if (!mediaItem.loading) {
	            var type = mediaItem.getAttribute('data-type');
	            var thumb = mediaItem.getAttribute('data-thumb') ? mediaItem.getAttribute('data-thumb') : '';
	            var src = '';
	            var mediaPath = '';
	            if (IOS4) {
	                mediaPath = 'media/thumb/?w=600&h=400&f=';
	            } else if (POD) {
	                mediaPath = 'media/thumb/?w=1024&h=768&f=';
	            } else {
	                mediaPath = 'media/original/';
	            }
	            switch (type) {
	                case IMAGE:
	                    src = mediaPath + mediaItem.getAttribute('data-content');
	                    break;
	                case VIDEO:
	                    src = thumb === '' ? 'inc/icn/videoLarge.png' : mediaPath + thumb;
	                    break;
	                case SWF:
	                    src = thumb === '' ? 'inc/icn/swfLarge.png' : mediaPath + thumb;
	                    break;
	                case PDF:
	                    src = thumb === '' ? 'inc/icn/pdfLarge.png' : mediaPath + thumb;
	                    break;
	            }
	            var mask = document.createElement('div');
	            mask.setAttribute('class', 'imageVideoMask');
	            mask.style.display = 'block';
	            mask.style.position = 'absolute';
	            mask.style.overflow = 'hidden';
	            mask.style.left = ImgLoader.imageVideoMarginLeft + 'px';
	            mask.style.top = ImgLoader.imageVideoMarginTop + 'px';
	            mask.style.width = (STAGE_WIDTH - (ImgLoader.imageVideoMarginLeft + ImgLoader.imageVideoMarginRight)) + 'px';
	            mask.style.height = (STAGE_HEIGHT - (ImgLoader.imageVideoMarginTop + ImgLoader.imageVideoMarginBottom)) + 'px';
	            mediaItem.appendChild(mask);
	            var img = document.createElement('img');
	            img.mediaItem = mediaItem;
	            img.setAttribute('class', IMAGE);
	            var path = (Address.base + src).replace(thumb, encodeURIComponent(thumb));
	            img.src = path;
	            mediaItem.loading = true;
	            img.style.opacity = 0;
	            var alt = mediaItem.getAttribute('data-label');
	            if (alt) img.alt = alt;
	            mediaItem.mask = mask;
	            img.mask = mask;
	            ImgLoader.loader(mediaItem);
	            img.addEventListener('load', ImgLoader.loaded, false);
	        }
	    };
	    ImgLoader.loader = function (mediaItem) {
	        mediaItem.style.width = STAGE_WIDTH + 'px';
	        mediaItem.style.height = STAGE_HEIGHT + 'px';
	        var avg, tint, loader, bg;
	        if ('' != '' && Address.getPath() == '' && Loader.type == 'spinner') {
	            bg = Util.hexToRGB('#ffffff');
	            avg = (bg.r + bg.g + bg.b) * 0.33;
	            tint = avg < 128 ? '#FFFFFF' : '#000000';
	            new Loader(mediaItem, 'spinner', '', tint);
	        } else if (Loader.type == 'spinner') {
	            bg = Util.hexToRGB('#ffffff');
	            avg = (bg.r + bg.g + bg.b) * 0.33;
	            tint = avg < 128 ? '#FFFFFF' : '#000000';
	            new Loader(mediaItem, 'spinner', '', tint);
	        } else {
	            new Loader(mediaItem);
	        }
	    };
	    ImgLoader.loaded = function (event) {
	        var img = event.target;
	        mediaItem = img.mediaItem;
	        mask = img.mask;
	        img.setAttribute('width', img.width);
	        img.setAttribute('height', img.height);
	        mask.appendChild(img);
	        Loader.remove(mediaItem);
	        mediaItem.loading = false;
	        mediaItem.loaded = true;
	        ImgLoader.resize(mediaItem);
	        if (Address.getPath() == '') {
	            new CSSTween(img, [1], ['opacity 1s cubic'], '', true);
	        } else {
	            new CSSTween(img, [1], ['opacity 1s cubic'], '', true);
	        }
	        Site.loadMediaItem(mediaItem.index);
	        if (mediaItem.getAttribute('data-type') == VIDEO) {
	            Video.buildBigPlay(mediaItem);
	            Video.autoLoad(Site.curMediaItem);
	            Video.loadPadVimeo(mediaItem);
	        }
	    };
	    ImgLoader.resize = function (mediaItem) {
	        var stageWidth, stageHeight;
	        if (Address.getPath() == '' && 'fit' == 'fillSite') {
	            stageWidth = window.innerWidth;
	            stageHeight = window.innerHeight;
	        } else {
	            stageWidth = STAGE_WIDTH - (ImgLoader.imageVideoMarginRight + ImgLoader.imageVideoMarginLeft), stageHeight = STAGE_HEIGHT - (ImgLoader.imageVideoMarginTop + ImgLoader.imageVideoMarginBottom);
	        }
	        if (mediaItem.loaded) {
	            var image = Site.getMediaAsset(mediaItem, IMAGE),
	                scale = ImgLoader.scale(image);
	            image._width = scale.width;
	            image._height = scale.height;
	            var align = ImgLoader.align(image);
	            image.left = align.left;
	            image.top = align.top;
	            if (Address.getPath() == '' && 'fit' == 'fillSite') {
	                new CSSTween(mediaItem.mask, [stageWidth + 'px', stageHeight + 'px', 0 + 'px', 0 + 'px'], ['width 0s linear', 'height 0s linear', 'left 0s linear', 'top 0s linear'], '', true);
	            } else {
	                new CSSTween(mediaItem.mask, [stageWidth + 'px', stageHeight + 'px', ImgLoader.imageVideoMarginLeft + 'px', ImgLoader.imageVideoMarginTop + 'px'], ['width 0s linear', 'height 0s linear', 'left 0s linear', 'top 0s linear'], '', true);
	            }
	            new CSSTween(image, [image._width + 'px', image._height + 'px', image.left + 'px', image.top + 'px'], ['width 0s linear', 'height 0s linear', 'left 0s linear', 'top 0s linear'], '', true);
	        }
	        if (Site.getMediaAsset(mediaItem, 'loader')) Loader.align(mediaItem);
	        if (Site.getMediaAsset(mediaItem, 'playBtn')) Video.alignPlayBtn(mediaItem);
	    };
	    ImgLoader.percentToPixels = function (value, range) {
	        if (value.search('%') > -1) {
	            value = value.replace('%', '');
	            value = (Number(value) * .01) * range;
	            return Math.round(value);
	        } else if (value.search('px') > -1) {
	            value = value.replace('px', '');
	            return Number(value);
	        } else {
	            return Number(value);
	        }
	    };
	    ImgLoader.scale = function (img) {
	        var scale = ['width', 'height'];
	        var stageWidth, stageHeight;
	        if (Address.getPath() == '' && 'fit' == 'fillSite') {
	            stageWidth = window.innerWidth;
	            stageHeight = window.innerHeight;
	        } else {
	            stageWidth = STAGE_WIDTH - (ImgLoader.imageVideoMarginRight + ImgLoader.imageVideoMarginLeft), stageHeight = STAGE_HEIGHT - (ImgLoader.imageVideoMarginTop + ImgLoader.imageVideoMarginBottom);
	        }
	        var imageRatio = img.getAttribute('width') / img.getAttribute('height');
	        var stageRatio = stageWidth / stageHeight;
	        if (Address.getPath() !== '' && 'fit' === 'native' && img.getAttribute('width') < stageWidth && img.getAttribute('height') < stageHeight) {
	            scale.width = img.getAttribute('width');
	            scale.height = img.getAttribute('height');
	        } else {
	            if (ImgLoader.fit(stageRatio, imageRatio)) {
	                scale.width = stageWidth;
	                scale.height = Math.round(stageWidth / imageRatio);
	            } else {
	                scale.width = Math.round(stageHeight * imageRatio);
	                scale.height = stageHeight;
	            }
	        }
	        return scale;
	    };
	    ImgLoader.fit = function (stageRatio, imageRatio) {
	        if (POD) {
	            return stageRatio < imageRatio;
	        } else if (Address.getPath() == '') {
	            switch ('fit') {
	                case 'fit':
	                    return stageRatio < imageRatio;
	                    break;
	                case 'fill':
	                    return stageRatio > imageRatio;
	                    break;
	                case 'fillSite':
	                    return stageRatio > imageRatio;
	                    break;
	            }
	        } else {
	            if (Site.curMediaItem && Site.curMediaItem.getAttribute('data-type') == VIDEO) {
	                return stageRatio < imageRatio;
	            } else {
	                switch ('fit') {
	                    case 'fit':
	                        return stageRatio < imageRatio;
	                        break;
	                    case 'fill':
	                        if (imageRatio < 1) {
	                            return stageRatio < imageRatio;
	                        } else {
	                            return stageRatio > imageRatio;
	                        }
	                        break;
	                    case 'native':
	                        return stageRatio < imageRatio;
	                        break;
	                }
	            }
	        }
	    };
	    ImgLoader.align = function (img) {
	        var stageWidth, stageHeight;
	        if (Address.getPath() == '' && 'fit' == 'fillSite') {
	            stageWidth = window.innerWidth;
	            stageHeight = window.innerHeight;
	        } else {
	            stageWidth = STAGE_WIDTH - (ImgLoader.imageVideoMarginRight + ImgLoader.imageVideoMarginLeft);
	            stageHeight = STAGE_HEIGHT - (ImgLoader.imageVideoMarginTop + ImgLoader.imageVideoMarginBottom);
	        }
	        var align = ['left', 'top'];
	        switch ('center') {
	            case 'center':
	                align.left = Math.round((stageWidth - img._width) * 0.5);
	                align.top = Math.round((stageHeight - img._height) * 0.5);
	                break;
	            case 'left':
	                align.left = 0;
	                align.top = Math.round((stageHeight - img._height) * 0.5);
	                break;
	            case 'right':
	                align.left = stageWidth - img._width;
	                align.top = Math.round((stageHeight - img._height) * 0.5);
	                break;
	        }
	        if (!POD && Address.getPath() != '' && 'fit' == 'fill' && Site.curMediaItem && Site.curMediaItem.getAttribute('data-type') !== VIDEO) {
	            align.top = 0;
	        } else if (!POD && Address.getPath() == '' && ('fit' == 'fill' || 'fit' == 'fillSite')) {
	            align.left = Math.round((stageWidth - img._width) * 0.5);
	            align.top = 0;
	        }
	        return align;
	    };
	    window.ImgLoader = ImgLoader;
	}(window));
	
	var Froogaloop = function () {
	    function e(c) {
	        return new e.fn.init(c)
	    }
	    function g(c, b, a) {
	        if (!a.contentWindow.postMessage) return !1;
	        var d = a.getAttribute("src").split("?")[0],
	            c = JSON.stringify({
	                method: c,
	                value: b
	            });
	        a.contentWindow.postMessage(c, d)
	    }
	    function i(c) {
	        var b, a;
	        try {
	            b = JSON.parse(c.data), a = b.event || b.method
	        } catch (l) {}
	        "ready" == a && !h && (h = !0);
	        if (c.origin != j) return !1;
	        var c = b.value,
	            e = b.data,
	            f = "" === f ? null : b.player_id;
	        b = f ? d[f][a] : d[a];
	        a = [];
	        if (!b) return !1;
	        void 0 !== c && a.push(c);
	        e && a.push(e);
	        f && a.push(f);
	        return 0 < a.length ? b.apply(null, a) : b.call()
	    }
	    function k(c, b, a) {
	        a ? (d[a] || (d[a] = {}), d[a][c] = b) : d[c] = b
	    }
	    var d = {}, h = !1,
	        j = "";
	    e.fn = e.prototype = {
	        element: null,
	        init: function (c) {
	            "string" === typeof c && (c = document.getElementById(c));
	            this.element = c;
	            for (var c = this.element.getAttribute("src").split("/"), b = "", a = 0, d = c.length; a < d; a++) {
	                if (3 > a) b += c[a];
	                else break;
	                2 > a && (b += "/")
	            }
	            j = b;
	            return this
	        },
	        api: function (c, b) {
	            if (!this.element || !c) return !1;
	            var a = this.element,
	                d = "" !== a.id ? a.id : null,
	                e = !b || !b.constructor || !b.call || !b.apply ? b : null,
	                f = b && b.constructor && b.call && b.apply ? b : null;
	            f && k(c, f, d);
	            g(c, e, a);
	            return this
	        },
	        addEvent: function (c, b) {
	            if (!this.element) return !1;
	            var a = this.element,
	                d = "" !== a.id ? a.id : null;
	            k(c, b, d);
	            "ready" != c ? g("addEventListener", c, a) : "ready" == c && h && b.call(null, d);
	            return this
	        },
	        removeEvent: function (c) {
	            if (!this.element) return !1;
	            var b = this.element,
	                a;
	            a: {
	                if ((a = "" !== b.id ? b.id : null) && d[a]) {
	                    if (!d[a][c]) {
	                        a = !1;
	                        break a
	                    }
	                    d[a][c] = null
	                } else {
	                    if (!d[c]) {
	                        a = !1;
	                        break a
	                    }
	                    d[c] = null
	                }
	                a = !0
	            }
	            "ready" != c && a && g("removeEventListener", c, b)
	        }
	    };
	    e.fn.init.prototype = e.fn;
	    window.addEventListener ? window.addEventListener("message", i, !1) : window.attachEvent("onmessage", i, !1);
	    return window.Froogaloop = window.$f = e
	}();
	
	(function (window) {
	    function Video() {}
	    Video.autoLoad = function (mediaItem) {
	        if (mediaItem && mediaItem.getAttribute('data-type') == VIDEO && (false || Address.getPath() == '')) {
	            if (!POD && !PAD) Video.load(mediaItem);
	        }
	    };
	    Video.btnLoad = function (event) {
	        var playBtn = event.target;
	        playBtn.removeEventListener(SELECT_EVENT, Video.btnLoad, false);
	        if (!DROID) new CSSTween(playBtn, [0], ['opacity .7s cubic']);
	        var mediaItem = playBtn.mediaItem;
	        Video.load(mediaItem);
	    };
	    Video.load = function (mediaItem) {
	        if (POD) {
	            Video.imageVideoMarginTop = 0, Video.imageVideoMarginRight = 0, Video.imageVideoMarginBottom = 0, Video.imageVideoMarginLeft = 0;
	        } else {
	            Video.imageVideoMarginTop = Video.percentToPixels('0', STAGE_HEIGHT), Video.imageVideoMarginRight = Video.percentToPixels('0', STAGE_WIDTH), Video.imageVideoMarginBottom = Video.percentToPixels('0', STAGE_HEIGHT), Video.imageVideoMarginLeft = Video.percentToPixels('150', STAGE_WIDTH);
	        }
	        if (!mediaItem.vid) {
	            var img = Site.getMediaAsset(mediaItem, IMAGE);
	            if (!DROID) new CSSTween(img, [0], ['opacity .7s cubic']);
	            var src = mediaItem.getAttribute('data-content');
	            var poster = mediaItem.getAttribute('data-thumb');
	            if (src.search("vimeo:") == 0) {
	                var img = Site.getMediaAsset(mediaItem, IMAGE);
	                img.style.zIndex = -3;
	                var vid = mediaItem.getElementsByTagName('iframe')[0];
	                vid.style.position = 'absolute';
	                var id = vid.getAttribute('id');
	                vid.setAttribute('class', VIDEO);
	                src = src.slice(6, src.length).replace(/^\s+|\s+$/g, '');
	                vid.setAttribute('src', 'http://player.vimeo.com/video/' + src + '?api=1&player_id=' + id);
	                vid.mediaItem = mediaItem;
	                vid.type = 'vimeo';
	                mediaItem.appendChild(vid);
	                mediaItem.vid = vid;
	                vid.style.opacity = 0;
	                ImgLoader.loader(mediaItem);
	                vid.vimeo = $f(vid); /*froogaloop*/
	                vid.vimeo.mediaItem = mediaItem;
	                vid.vimeo.addEvent('ready', Video.VimeoLoaded);
	            } else {
	                if (DROID) {
	                    window.location = Address.base + 'media/original/' + src;
	                } else {
	                    var vid = document.createElement('video');
	                    vid.setAttribute('class', VIDEO);
	                    if (IOS4) {
	                        vid.setAttribute('src', Address.base + 'media/original/' + src.replace(Util.getExt(src), 'mobile.mp4'));
	                    } else if (Firefox) {
	                        vid.setAttribute('src', Address.base + 'media/original/' + src.replace(Util.getExt(src), 'webm'));
	                    } else {
	                        vid.setAttribute('src', Address.base + 'media/original/' + src);
	                    }
	                    vid.load();
	                    vid.mediaItem = mediaItem;
	                    mediaItem.appendChild(vid);
	                    mediaItem.vid = vid;
	                    vid.style.opacity = 0;
	                    ImgLoader.loader(mediaItem);
	                    vid.addEventListener('loadedmetadata', Video.loaded, false);
	                }
	            }
	        } else if (mediaItem.vid && (false || Address.getPath() == '')) {
	            try {
	                Video.play(mediaItem.vid);
	            } catch (err) {
	                trace(err)
	            };
	        }
	    };
	    Video.loadPadVimeo = function (mediaItem) {
	        if (mediaItem.getAttribute('data-content').search("vimeo:") == 0 && PAD) {
	            Video.imageVideoMarginTop = Video.percentToPixels('0', STAGE_HEIGHT), Video.imageVideoMarginRight = Video.percentToPixels('0', STAGE_WIDTH), Video.imageVideoMarginBottom = Video.percentToPixels('0', STAGE_HEIGHT), Video.imageVideoMarginLeft = Video.percentToPixels('150', STAGE_WIDTH);
	            mediaItem.playBtn.style.zIndex = -2;
	            mediaItem.playBtn.removeEventListener(SELECT_EVENT, Video.btnLoad, false);
	            var img = Site.getMediaAsset(mediaItem, IMAGE);
	            img.style.zIndex = -3;
	            var vid = mediaItem.getElementsByTagName('iframe')[0];
	            var src = mediaItem.getAttribute('data-content');
	            src = src.slice(6, src.length).replace(/^\s+|\s+$/g, '');
	            var id = vid.getAttribute('id');
	            vid.setAttribute('src', 'http://player.vimeo.com/video/' + src + '?api=1&player_id=' + id);
	            vid.style.opacity = 0;
	            vid.style.zIndex = 5;
	            vid.width = 70;
	            vid.height = 70;
	            vid.style.position = 'absolute';
	            vid.style.left = (STAGE_WIDTH - 70) * 0.5 + 'px';
	            vid.style.top = (STAGE_HEIGHT - 70) * 0.5 + 'px';
	            vid.setAttribute('class', VIDEO);
	            vid.mediaItem = mediaItem;
	            vid.type = 'vimeo';
	            mediaItem.vid = vid;
	            Video.resize(vid);
	            vid.vimeo = $f(vid);
	            vid.vimeo.mediaItem = mediaItem;
	            vid.vimeo.addEvent('ready', Video.VimeoLoadedPad);
	        }
	    };
	    Video.loaded = function (event) {
	        var vid = event.target;
	        var mediaItem = vid.mediaItem;
	        mediaItem.vid = vid;
	        vid.loaded = true;
	        mediaItem.vidLoaded = true;
	        Video.resize(vid);
	        Loader.remove(mediaItem);
	        new CSSTween(vid, [1], ['opacity .7s cubic']);
	        vid.addEventListener('ended', Video.ended, false);
	        if (Address.getPath() != '' && !POD) Video.drawHud(mediaItem);
	        Video.play(vid);
	        if (Site.touchNav) TouchNav.addListener(vid);
	        if (Address.getPath() == '') {
	            clearInterval(Site.slideInterval);
	            Site.slideInterval = null;
	        }
	    };
	    Video.VimeoLoadedPad = function (id) {
	        var vid = document.getElementById(id);
	        var vimeo = vid.vimeo = $f(vid);
	        vid.loaded = true;
	        vid.videoWidth = vid.getAttribute('width');
	        vid.videoHeight = vid.getAttribute('height');
	        vid.vimeo.addEvent('play', function (data) {
	            Site.resize();
	            vid.vimeo.api('getVideoWidth', function (value, id) {
	                vid.setAttribute('width', value);
	                vid.videoWidth = value;
	            });
	            vid.vimeo.api('getVideoHeight', function (value, id) {
	                vid.setAttribute('height', value);
	                vid.videoHeight = value;
	            });
	            setTimeout(function (vid) {
	                vid.style.display = 'block';
	                Video.resize(vid);
	                vid.style.left = (STAGE_WIDTH - vid.width) * 0.5 + 'px';
	                vid.style.top = (STAGE_HEIGHT - vid.height) * 0.5 + 'px';
	                var img = Site.getMediaAsset(vid.mediaItem, IMAGE);
	                new CSSTween(img, [0], ['opacity .7s cubic']);
	                vid.style.opacity = 1;
	                new CSSTween(vid, [1], ['opacity .7s cubic']);
	                vid.style.zIndex = 0;
	                img.style.zIndex = 1;
	            }, 100, vid);
	            var bigPlayBtn = vid.mediaItem.playBtn;
	            new CSSTween(bigPlayBtn, [0], ['opacity .7s cubic']);
	            bigPlayBtn.style.zIndex = 3;
	            bigPlayBtn.removeEventListener(SELECT_EVENT, Video.bigPlay, false);
	        });
	        vid.vimeo.addEvent('pause', function (data) {
	            var img = Site.getMediaAsset(vid.mediaItem, IMAGE);
	            new CSSTween(img, [1], ['opacity .7s cubic']);
	            new CSSTween(vid, [0], ['opacity .7s cubic']);
	            var bigPlayBtn = vid.mediaItem.playBtn;
	            new CSSTween(bigPlayBtn, [1], ['opacity .7s cubic']);
	            bigPlayBtn.style.zIndex = 3;
	            bigPlayBtn.removeEventListener(SELECT_EVENT, Video.bigPlay, false);
	        });
	    };
	    Video.VimeoLoaded = function (id) {
	        var vid = document.getElementById(id);
	        var vimeo = vid.vimeo;
	        vid.loaded = true; /*defualt vid width*/
	        vid.videoWidth = vid.getAttribute('width');
	        vid.videoHeight = vid.getAttribute('height');
	        vid.vimeo.api('getVideoWidth', function (value, id) {
	            vid.setAttribute('width', value);
	            vid.videoWidth = value;
	            Video.resize(vid);
	        });
	        vid.vimeo.api('getVideoHeight', function (value, id) {
	            vid.setAttribute('height', value);
	            vid.videoHeight = value;
	            Video.resize(vid);
	        });
	        vid.vimeo.addEvent('play', function (data) {
	            Site.resize();
	            Video.resize(vid);
	            var img = Site.getMediaAsset(vid.mediaItem, IMAGE);
	            new CSSTween(img, [0], ['opacity .7s cubic']);
	            new CSSTween(vid, [1], ['opacity .7s cubic']);
	            var bigPlayBtn = vid.mediaItem.playBtn;
	            new CSSTween(bigPlayBtn, [0], ['opacity .7s cubic']);
	            bigPlayBtn.removeEventListener(SELECT_EVENT, Video.bigPlay, false);
	        });
	        var mediaItem = vimeo.mediaItem;
	        vid.loaded = true;
	        mediaItem.vidLoaded = true;
	        Loader.remove(mediaItem);
	        setTimeout(function (vid) {
	            Site.resize();
	            Video.resize(vid);
	            new CSSTween(vid, [1], ['opacity .7s cubic']);
	        }, 1000, vid);
	        vimeo.addEvent('finish', Video.ended, false);
	        Video.play(vid);
	        if (Site.touchNav && Site.curMediaItems.length > 1) TouchNav.addListener(vid);
	        if (Address.getPath() == '') {
	            clearInterval(Site.slideInterval);
	            Site.slideInterval = null;
	        }
	    };
	    Video.resize = function (vid) {
	        var stageWidth, stageHeight;
	        if (Address.getPath() == '' && 'fit' == 'fillSite') {
	            stageWidth = window.innerWidth;
	            stageHeight = window.innerHeight;
	        } else {
	            stageWidth = STAGE_WIDTH - (Video.imageVideoMarginRight + Video.imageVideoMarginLeft), stageHeight = STAGE_HEIGHT - (Video.imageVideoMarginTop + Video.imageVideoMarginBottom);
	        }
	        if (vid.loaded && !POD) {
	            var scale = Video.scale(vid);
	            vid.width = scale.width;
	            vid.height = scale.height;
	            var align = Video.align(vid);
	            vid.left = align.left;
	            vid.top = align.top;
	            new CSSTween(vid, [vid.width + 'px', vid.height + 'px', vid.left + 'px', vid.top + 'px'], ['width 0s linear', 'height 0s linear', 'left 0s linear', 'top 0s linear']);
	            if (vid.hud) Video.hudResize(vid);
	        } else if (vid.loaded && POD) {
	            vid.style.opacity = 0.01;
	            vid.style.width = '0px';
	            vid.style.height = '0px';
	            vid.style.top = (window.innerHeight * 0.5) + 'px';
	            vid.style.left = (window.innerWidth * 0.5) + 'px';
	        }
	    };
	    Video.percentToPixels = function (value, range) {
	        if (value.search('%') > -1) {
	            value = value.replace('%', '');
	            value = (Number(value) * .01) * range;
	            return Math.round(value);
	        } else if (value.search('px') > -1) {
	            value = value.replace('px', '');
	            return Number(value);
	        } else {
	            return Number(value);
	        }
	    };
	    Video.scale = function (vid) {
	        var scale = ['width', 'height'];
	        var stageWidth = STAGE_WIDTH - (Video.imageVideoMarginRight + Video.imageVideoMarginLeft);
	        var stageHeight = STAGE_HEIGHT - (Video.imageVideoMarginTop + Video.imageVideoMarginBottom);
	        if ('fit' == 'fillSite' && Address.getPath() == '') {
	            var imageRatio = vid.videoWidth / vid.videoHeight;
	            var stageRatio = STAGE_WIDTH / STAGE_HEIGHT;
	            if (stageRatio > imageRatio) {
	                scale.width = STAGE_WIDTH;
	                scale.height = Math.round(STAGE_WIDTH / imageRatio);
	            } else {
	                scale.width = Math.round(STAGE_HEIGHT * imageRatio);
	                scale.height = STAGE_HEIGHT;
	            }
	        } else if ('stretch' == 'stretch' || vid.videoWidth > stageWidth || vid.videoHeight > stageHeight) {
	            var imageRatio = vid.videoWidth / vid.videoHeight;
	            var stageRatio = stageWidth / stageHeight;
	            if (stageRatio < imageRatio) {
	                scale.width = stageWidth;
	                scale.height = Math.round(stageWidth / imageRatio);
	            } else {
	                scale.width = Math.round(stageHeight * imageRatio);
	                scale.height = stageHeight;
	            }
	        } else {
	            scale.width = vid.videoWidth;
	            scale.height = vid.videoHeight;
	        }
	        return scale;
	    };
	    Video.align = function (vid) {
	        var stageWidth, stageHeight;
	        if (Address.getPath() == '' && 'fit' == 'fillSite') {
	            stageWidth = window.innerWidth;
	            stageHeight = window.innerHeight;
	        } else {
	            stageWidth = STAGE_WIDTH - (Video.imageVideoMarginRight + Video.imageVideoMarginLeft);
	            stageHeight = STAGE_HEIGHT - (Video.imageVideoMarginTop + Video.imageVideoMarginBottom);
	        }
	        var align = ['left', 'top'];
	        switch ('center') {
	            case 'center':
	                align.left = Math.round((STAGE_WIDTH - vid.width) * 0.5);
	                align.top = Math.round((STAGE_HEIGHT - vid.height) * 0.5);
	                break;
	            case 'left':
	                align.left = Video.imageVideoMarginLeft;
	                align.top = Math.round((STAGE_HEIGHT - vid.height) * 0.5);
	                break;
	            case 'right':
	                align.left = STAGE_WIDTH - vid.width - Video.imageVideoMarginRight;
	                align.top = Math.round((STAGE_HEIGHT - vid.height) * 0.5);
	                break;
	        }
	        if (Address.getPath() === '' && ('fit' == 'fillSite')) {
	            align.left = Math.round((STAGE_WIDTH - vid.width) * 0.5);
	            align.top = 0;
	        }
	        return align;
	    };
	    Video.hudResize = function (vid) {
	        vid.hud.width = vid.width;
	        new CSSTween(vid.hud, [vid.width + 'px', vid.left + 'px', vid.top + (vid.height - vid.hud.height) + 'px'], ['width 0s linear', 'left 0s linear', 'top 0s linear']);
	        new CSSTween(vid.hud.muteBtn, [(vid.width - (vid.hud.btnWidth * 2)) + 'px'], ['left 0s linear']);
	        new CSSTween(vid.hud.fullBtn, [(vid.width - vid.hud.btnWidth) + 'px'], ['left 0s linear']);
	        if (vid.hud) Video.updateProgress(vid);
	    };
	    Video.ended = function (event) {
	        if (Address.getPath() != '') {
	            var vid = event.target;
	            var mediaItem = event.target.mediaItem;
	            var playBtn = mediaItem.playBtn;
	            playBtn.addEventListener(SELECT_EVENT, Video.bigPlay, false);
	            new CSSTween(playBtn, [1], ['opacity .7s cubic']);
	        } else if (Address.getPath() == '') {
	            if (Site.curMediaItemsInSection > 1) {
	                Site.next();
	            } else if (Site.curMediaItem.getAttribute('data-type') == VIDEO && !POD && !PAD) {
	                var vid = event.target;
	                Video.play(vid);
	            }
	        }
	    };
	    Video.buildBigPlay = function (mediaItem) {
	        var playBtn = document.createElement('img');
	        playBtn.setAttribute('class', 'playBtn');
	        playBtn.setAttribute('src', Address.base + 'inc/icn/play@2x.png');
	        mediaItem.playBtn = playBtn;
	        playBtn.setAttribute('width', '70');
	        playBtn.setAttribute('height', '70');
	        playBtn.style.opacity = 0;
	        mediaItem.appendChild(playBtn);
	        if (!false && Address.getPath() != '') {
	            new CSSTween(playBtn, [1], ['opacity .2s cubic']);
	        } else if (PAD || POD) {
	            new CSSTween(playBtn, [1], ['opacity .2s cubic']);
	        }
	        playBtn.style.zIndex = 4;
	        Video.alignPlayBtn(mediaItem);
	        playBtn.mediaItem = mediaItem;
	        mediaItem.vidLoaded = false;
	        playBtn.addEventListener(SELECT_EVENT, Video.btnLoad, false);
	    };
	    Video.alignPlayBtn = function (mediaItem) {
	        var playBtn = Site.getMediaAsset(mediaItem, 'playBtn');
	        var left = Math.floor((STAGE_WIDTH - playBtn.width) * 0.5);
	        var top = Math.floor((STAGE_HEIGHT - playBtn.width) * 0.5);
	        new CSSTween(playBtn, [left + 'px', top + 'px'], ['left 0s linear', 'top 0s linear']);
	    };
	    Video.bigPlay = function (event) {
	        var playBtn = event.target;
	        var mediaItem = event.target.mediaItem;
	        var vid = mediaItem.vid;
	        playBtn.removeEventListener(SELECT_EVENT, Video.bigPlay, false);
	        new CSSTween(playBtn, [0], ['opacity .7s cubic']);
	        Video.play(vid);
	    };
	    Video.drawHud = function (mediaItem) {
	        var vid = mediaItem.vid;
	        var hud = document.createElement('div');
	        Video.resize(vid);
	        hud.height = 50;
	        hud.width = 0;
	        hud.btnWidth = hud.height;
	        hud.scrubWidth = 0;
	        hud.show = true;
	        hud.style.opacity = 1;
	        hud.style.zIndex = 5;
	        hud.style.position = 'absolute';
	        hud.style.left = vid.style.left + 'px';
	        hud.style.bottom = 0 + 'px';
	        mediaItem.appendChild(hud);
	        mediaItem.hud = hud;
	        vid.hud = hud;
	        hud.playBtn = document.createElement('div');
	        hud.playBtn.mediaItem = mediaItem;
	        hud.playBtn.style.display = 'block';
	        hud.playBtn.style.position = 'absolute';
	        hud.playBtn.style.width = hud.btnWidth + 'px';
	        hud.playBtn.style.height = hud.height + 'px';
	        hud.appendChild(hud.playBtn);
	        hud.playBtn.bg = document.createElement('div');
	        hud.playBtn.bg.style.display = 'block';
	        hud.playBtn.bg.style.position = 'absolute';
	        hud.playBtn.bg.style.backgroundColor = '#000';
	        hud.playBtn.bg.style.opacity = .65;
	        hud.playBtn.bg.style.width = hud.btnWidth + 'px';
	        hud.playBtn.bg.style.height = hud.height + 'px';
	        hud.playBtn.appendChild(hud.playBtn.bg);
	        hud.playBtn.icon = document.createElement('div');
	        hud.playBtn.icon.style.position = 'absolute';
	        hud.playBtn.icon.style.font = "400 8px/0px 'iconsRegular'";
	        hud.playBtn.icon.style.color = '#FFF';
	        hud.playBtn.icon.innerHTML = "'";
	        hud.playBtn.icon.style.opacity = .5;
	        hud.playBtn.appendChild(hud.playBtn.icon);
	        var iconWidth = 8;
	        hud.playBtn.icon.style.left = (hud.btnWidth - iconWidth) * 0.5 + 'px';
	        hud.playBtn.icon.style.top = -3 + 'px';
	        hud.playBtn.hit = document.createElement('div');
	        hud.playBtn.hit.style.position = 'absolute';
	        hud.playBtn.hit.style.display = 'block';
	        hud.playBtn.hit.style.width = hud.btnWidth + 'px';
	        hud.playBtn.hit.style.height = hud.height + 'px';
	        hud.playBtn.appendChild(hud.playBtn.hit);
	        hud.playBtn.vid = vid;
	        hud.playBtn.mediaItem = mediaItem;
	        hud.playBtn.hit.parent = hud.playBtn;
	        hud.muteBtn = document.createElement('div');
	        hud.muteBtn.mediaItem = mediaItem;
	        hud.muteBtn.style.display = 'block';
	        hud.muteBtn.style.position = 'absolute';
	        hud.muteBtn.style.width = hud.btnWidth + 'px';
	        hud.muteBtn.style.height = hud.height + 'px';
	        hud.appendChild(hud.muteBtn);
	        hud.muteBtn.bg = document.createElement('div');
	        hud.muteBtn.bg.style.display = 'block';
	        hud.muteBtn.bg.style.position = 'absolute';
	        hud.muteBtn.bg.style.backgroundColor = '#000';
	        hud.muteBtn.bg.style.opacity = .65;
	        hud.muteBtn.bg.style.width = hud.btnWidth + 'px';
	        hud.muteBtn.bg.style.height = hud.height + 'px';
	        hud.muteBtn.appendChild(hud.muteBtn.bg);
	        hud.muteBtn.icon = document.createElement('div');
	        hud.muteBtn.icon.style.position = 'absolute';
	        hud.muteBtn.icon.style.font = "400 8px/0px 'iconsRegular'";
	        hud.muteBtn.icon.style.color = '#FFF';
	        hud.muteBtn.icon.innerHTML = "(";
	        hud.muteBtn.icon.style.opacity = .5;
	        hud.muteBtn.appendChild(hud.muteBtn.icon);
	        var iconWidth = 10;
	        hud.muteBtn.icon.style.left = (hud.btnWidth - iconWidth) * 0.5 + 'px';
	        hud.muteBtn.icon.style.top = -3 + 'px';
	        hud.muteBtn.hit = document.createElement('div');
	        hud.muteBtn.hit.style.position = 'absolute';
	        hud.muteBtn.hit.style.display = 'block';
	        hud.muteBtn.hit.style.width = hud.btnWidth + 'px';
	        hud.muteBtn.hit.style.height = hud.height + 'px';
	        hud.muteBtn.appendChild(hud.muteBtn.hit);
	        hud.muteBtn.vid = vid;
	        hud.muteBtn.mediaItem = mediaItem;
	        hud.muteBtn.hit.parent = hud.muteBtn;
	        hud.fullBtn = document.createElement('div');
	        hud.fullBtn.mediaItem = mediaItem;
	        hud.fullBtn.style.display = 'block';
	        hud.fullBtn.style.position = 'absolute';
	        hud.fullBtn.style.width = hud.btnWidth + 'px';
	        hud.fullBtn.style.height = hud.height + 'px';
	        hud.appendChild(hud.fullBtn);
	        hud.fullBtn.bg = document.createElement('div');
	        hud.fullBtn.bg.style.display = 'block';
	        hud.fullBtn.bg.style.position = 'absolute';
	        hud.fullBtn.bg.style.backgroundColor = '#000';
	        hud.fullBtn.bg.style.opacity = .65;
	        hud.fullBtn.bg.style.width = hud.btnWidth + 'px';
	        hud.fullBtn.bg.style.height = hud.height + 'px';
	        hud.fullBtn.appendChild(hud.fullBtn.bg);
	        hud.fullBtn.icon = document.createElement('div');
	        hud.fullBtn.icon.style.position = 'absolute';
	        hud.fullBtn.icon.style.font = "400 8px/0px 'iconsRegular'";
	        hud.fullBtn.icon.style.color = '#FFF';
	        hud.fullBtn.icon.innerHTML = "?";
	        hud.fullBtn.icon.style.opacity = .5;
	        hud.fullBtn.appendChild(hud.fullBtn.icon);
	        var iconWidth = 10;
	        hud.fullBtn.icon.style.left = (hud.btnWidth - iconWidth) * 0.5 + 'px';
	        hud.fullBtn.icon.style.top = -2 + 'px';
	        hud.fullBtn.hit = document.createElement('div');
	        hud.fullBtn.hit.style.position = 'absolute';
	        hud.fullBtn.hit.style.display = 'block';
	        hud.fullBtn.hit.style.width = hud.btnWidth + 'px';
	        hud.fullBtn.hit.style.height = hud.height + 'px';
	        hud.fullBtn.appendChild(hud.fullBtn.hit);
	        hud.fullBtn.vid = vid;
	        hud.fullBtn.mediaItem = mediaItem;
	        hud.fullBtn.hit.parent = hud.fullBtn;
	        hud.scrub = document.createElement('div');
	        hud.scrub.mediaItem = mediaItem;
	        hud.scrub.style.display = 'block';
	        hud.scrub.style.position = 'absolute';
	        hud.scrub.style.zIndex = -1;
	        hud.scrub.style.left = hud.btnWidth + 'px';
	        hud.scrub.style.width = hud.btnWidth + 'px';
	        hud.scrub.style.height = hud.height + 'px';
	        hud.appendChild(hud.scrub);
	        hud.scrub.bg = document.createElement('div');
	        hud.scrub.bg.style.display = 'block';
	        hud.scrub.bg.style.position = 'absolute';
	        hud.scrub.bg.style.backgroundColor = '#000';
	        hud.scrub.bg.style.opacity = .65;
	        hud.scrub.bg.style.width = '100%';
	        hud.scrub.bg.style.height = hud.height + 'px';
	        hud.scrub.appendChild(hud.scrub.bg);
	        hud.scrub.buffer = document.createElement('div');
	        hud.scrub.buffer.style.display = 'block';
	        hud.scrub.buffer.style.position = 'absolute';
	        hud.scrub.buffer.style.backgroundColor = '#FFF';
	        hud.scrub.buffer.style.opacity = .12;
	        hud.scrub.buffer.style.width = 1 + 'px';
	        hud.scrub.buffer.style.height = hud.height + 'px';
	        hud.scrub.appendChild(hud.scrub.buffer);
	        hud.scrub.progress = document.createElement('div');
	        hud.scrub.progress.style.display = 'block';
	        hud.scrub.progress.style.position = 'absolute';
	        hud.scrub.progress.style.backgroundColor = '#FFF';
	        hud.scrub.progress.style.opacity = .25;
	        hud.scrub.progress.style.width = 1 + 'px';
	        hud.scrub.progress.style.height = hud.height + 'px';
	        hud.scrub.appendChild(hud.scrub.progress);
	        hud.scrub.time = document.createElement('div');
	        hud.scrub.time.style.position = 'absolute';
	        hud.scrub.time.style.font = "400 8px/0px 'iconsRegular'";
	        hud.scrub.time.style.color = '#FFF';
	        hud.scrub.time.innerHTML = "00:00 / 00:00";
	        hud.scrub.time.style.opacity = .5;
	        hud.scrub.appendChild(hud.scrub.time);
	        hud.scrub.time.style.left = 10 + 'px';
	        hud.scrub.time.style.top = -3 + 'px';
	        hud.scrub.head = document.createElement('div');
	        hud.scrub.head.style.display = 'block';
	        hud.scrub.head.style.position = 'absolute';
	        hud.scrub.head.style.backgroundColor = '#FFF';
	        hud.scrub.head.style.opacity = 0;
	        hud.scrub.head.style.left = 30 + 'px';
	        hud.scrub.head.style.width = 1 + 'px';
	        hud.scrub.head.style.height = hud.height + 'px';
	        hud.scrub.appendChild(hud.scrub.head);
	        hud.scrub.headTime = document.createElement('div');
	        hud.scrub.headTime.style.display = 'block';
	        hud.scrub.headTime.style.position = 'absolute';
	        hud.scrub.headTime.style.font = "400 8px/0px 'iconsRegular'";
	        hud.scrub.headTime.style.color = '#FFF';
	        hud.scrub.headTime.style.opacity = 0;
	        hud.scrub.headTime.innerHTML = "00:00";
	        hud.scrub.headTime.style.left = 30 + 'px';
	        hud.scrub.headTime.style.top = -35 + 'px';
	        hud.scrub.appendChild(hud.scrub.headTime);
	        hud.scrub.hit = document.createElement('div');
	        hud.scrub.hit.style.position = 'absolute';
	        hud.scrub.hit.style.display = 'block';
	        hud.scrub.hit.style.width = '100%';
	        hud.scrub.hit.style.height = hud.height + 'px';
	        hud.scrub.appendChild(hud.scrub.hit);
	        hud.scrub.vid = vid;
	        hud.scrub.mediaItem = mediaItem;
	        hud.scrub.hit.parent = hud.scrub;
	        hud.playBtn.hit.addEventListener('mouseover', Video.hudBtnOver, false);
	        hud.playBtn.hit.addEventListener('mouseout', Video.hudBtnOut, false);
	        hud.scrub.hit.addEventListener('mouseover', Video.hudScrubOver, false);
	        hud.scrub.hit.addEventListener('mouseout', Video.hudScrubOut, false);
	        hud.muteBtn.hit.addEventListener('mouseover', Video.hudBtnOver, false);
	        hud.muteBtn.hit.addEventListener('mouseout', Video.hudBtnOut, false);
	        hud.fullBtn.hit.addEventListener('mouseover', Video.hudBtnOver, false);
	        hud.fullBtn.hit.addEventListener('mouseout', Video.hudBtnOut, false);
	        hud.playBtn.hit.addEventListener(SELECT_EVENT, Video.hudPlayPause, false);
	        hud.muteBtn.hit.addEventListener(SELECT_EVENT, Video.hudMute, false);
	        if (PAD || POD) {
	            hud.fullBtn.hit.addEventListener(SELECT_EVENT, Fullscreen.i, false);
	        } else {
	            hud.fullBtn.hit.addEventListener(SELECT_EVENT, Fullscreen, false);
	        }
	        if (touchDevice) {
	            hud.scrub.hit.addEventListener('touchstart', Video.scrubSeek, false);
	        } else {
	            hud.scrub.hit.addEventListener('mousemove', Video.scrubMove, false);
	            hud.scrub.hit.addEventListener('click', Video.scrubSeek, false);
	        }
	        Video.resize(vid);
	    };
	    Video.scrubMove = function (event) {
	        var scrub = event.target.parent;
	        var pointX = 0;
	        if (touchDevice) {
	            pointX = event.touches[0].offsetX - scrub.vid.hud.height - scrub.vid.left;
	        } else {
	            pointX = event.offsetX;
	        }
	        scrub.head.style.left = pointX + 'px';
	        scrub.headTime.style.left = pointX + 'px';
	        var scrubWidth = scrub.vid.width - (scrub.vid.hud.btnWidth * 3);
	        var dropInPoint = Video.secondsToTime((pointX / scrubWidth) * scrub.vid.duration);
	        scrub.headTime.innerHTML = dropInPoint;
	    };
	    Video.scrubSeek = function (event) {
	        var scrub = event.target.parent;
	        var pointX = 0;
	        if (touchDevice) {
	            pointX = event.touches[0].pageX - scrub.vid.hud.height - scrub.vid.left;
	        } else {
	            pointX = event.offsetX;
	        }
	        scrub.head.style.left = pointX + 'px';
	        scrub.headTime.style.left = pointX + 'px';
	        var scrubWidth = scrub.vid.width - (scrub.vid.hud.btnWidth * 3);
	        var dropInPoint = (pointX / scrubWidth) * scrub.vid.duration;
	        scrub.vid.currentTime = dropInPoint;
	        scrub.headTime.innerHTML = Video.secondsToTime(dropInPoint);
	        if (scrub.vid.hud) Video.updateProgress(scrub.vid);
	    };
	    Video.showHud = function () {
	        var hud = Site.curMediaItem.vid.hud;
	        if (!hud.show) {
	            hud.show = true;
	            hud.style.display = 'block';
	            new CSSTween(hud, [1], ['opacity .5s cubic'], '', true);
	        }
	    };
	    Video.hideHud = function () {
	        var hud = Site.curMediaItem.vid.hud;
	        if (hud.show) {
	            hud.show = false;
	            new CSSTween(hud, [0], ['opacity .5s cubic'], function () {
	                hud.style.display = 'none';
	            }, true);
	        }
	    };
	    Video.hudScrubOver = function (event) {
	        var scrub = event.target.parent;
	        new CSSTween(scrub.bg, [.7], ['opacity .5s cubic']);
	        new CSSTween(scrub.buffer, [.2], ['opacity .5s cubic']);
	        new CSSTween(scrub.progress, [.4], ['opacity .5s cubic']);
	        new CSSTween(scrub.time, [1], ['opacity .5s cubic']);
	        new CSSTween(scrub.head, [1], ['opacity .5s cubic']);
	        new CSSTween(scrub.headTime, [.65], ['opacity .5s cubic']);
	    };
	    Video.hudScrubOut = function (event) {
	        var scrub = event.target.parent;
	        new CSSTween(scrub.bg, [.65], ['opacity .5s cubic']);
	        new CSSTween(scrub.buffer, [.12], ['opacity .5s cubic']);
	        new CSSTween(scrub.progress, [.25], ['opacity .5s cubic']);
	        new CSSTween(scrub.time, [.5], ['opacity .5s cubic']);
	        new CSSTween(scrub.head, [0], ['opacity .5s cubic']);
	        new CSSTween(scrub.headTime, [0], ['opacity .5s cubic']);
	    };
	    Video.hudBtnOver = function (event) {
	        var playBtn = event.target.parent;
	        new CSSTween(playBtn.bg, [.85], ['opacity .5s cubic']);
	        new CSSTween(playBtn.icon, [1], ['opacity .5s cubic']);
	    };
	    Video.hudBtnOut = function (event) {
	        var playBtn = event.target.parent;
	        new CSSTween(playBtn.bg, [.65], ['opacity .5s cubic']);
	        new CSSTween(playBtn.icon, [.5], ['opacity .5s cubic']);
	    };
	    Video.showHudPlayBtn = function (playBtn) {
	        playBtn.icon.style.top = -2 + 'px';
	        playBtn.icon.innerHTML = "&";
	    };
	    Video.showHudPauseBtn = function (playBtn) {
	        playBtn.icon.style.top = -3 + 'px';
	        playBtn.icon.innerHTML = "'";
	    };
	    Video.hudPlayPause = function (event) {
	        var playBtn = event.target.parent;
	        var vid = playBtn.vid;
	        if (vid.paused) {
	            Video.play(vid);
	        } else {
	            Video.pause(vid);
	        }
	    };
	    Video.play = function (vid) {
	        vid.type == 'vimeo' ? vid.vimeo.api('play') : vid.play();
	        vid.paused = false;
	        if (vid.hud) Video.showHudPauseBtn(vid.hud.playBtn);
	        var bigPlayBtn = vid.mediaItem.playBtn;
	        new CSSTween(bigPlayBtn, [0], ['opacity .7s cubic']);
	        bigPlayBtn.removeEventListener(SELECT_EVENT, Video.bigPlay, false);
	        if (vid.hud) vid.progInterval = setInterval(function () {
	                Video.updateProgress(vid)
	            }, 30);
	        if (POD) {
	            var img = Site.getMediaAsset(vid.mediaItem, IMAGE);
	            new CSSTween(img, [0], ['opacity .7s cubic']);
	            Video.resize(vid);
	            Fullscreen.PodInterval = setInterval(Fullscreen.checkPOD, 800);
	            vid.webkitEnterFullscreen();
	        }
	        if (POD || PAD) Menu.close();
	    };
	    Video.pause = function (vid) {
	        vid.type == 'vimeo' ? vid.vimeo.api('pause') : vid.pause();
	        if (vid.hud) Video.showHudPlayBtn(vid.hud.playBtn);
	        vid.paused = true;
	        if (!POD && Site.state != SLIDESHOW) {
	            var bigPlayBtn = vid.mediaItem.playBtn;
	            bigPlayBtn.style.display = 'block';
	            new CSSTween(bigPlayBtn, [1], ['opacity .7s cubic']);
	            bigPlayBtn.addEventListener(SELECT_EVENT, Video.bigPlay, false);
	        }
	    };
	    Video.playPause = function () {
	        var mediaItem = Site.curMediaItem;
	        if (mediaItem.getAttribute('data-type') === VIDEO) {
	            if (mediaItem.vidLoaded) {
	                var vid;
	                if (mediaItem.getAttribute('data-content').search("vimeo:") == 0) {
	                    vid = mediaItem.getElementsByTagName('iframe')[0];
	                } else {
	                    vid = Site.getMediaAsset(Site.curMediaItem, VIDEO);
	                }
	                vid.paused ? Video.play(vid) : Video.pause(vid);
	            } else {
	                Video.load(Site.curMediaItem);
	            }
	        }
	    };
	    Video.pauseCur = function () {
	        if (Site.curMediaItem) {
	            if (Site.curMediaItem.vid) {
	                Video.pause(Site.curMediaItem.vid);
	                clearInterval(Site.curMediaItem.vid.progInterval);
	            }
	        }
	    };
	    Video.hudMute = function (event) {
	        var muteBtn = event.target.parent;
	        var vid = muteBtn.vid;
	        if (vid.volume == 1) {
	            Video.mute(vid);
	        } else {
	            Video.unmute(vid);
	        }
	    };
	    Video.mute = function (vid) {
	        vid.volume = 0;
	        vid.hud.muteBtn.icon.style.top = -2 + 'px';
	        vid.hud.muteBtn.icon.innerHTML = ")";
	    };
	    Video.unmute = function (vid) {
	        vid.volume = 1;
	        vid.hud.muteBtn.icon.style.top = -2 + 'px';
	        vid.hud.muteBtn.icon.innerHTML = "(";
	    };
	    Video.updateProgress = function (vid) {
	        scrubWidth = vid.width - (vid.hud.btnWidth * 3);
	        new CSSTween(vid.hud.scrub, [scrubWidth + 'px'], ['width 0s linear']);
	        if (vid.buffered.length > 0) {
	            bufferedPercent = vid.buffered.end(0) / vid.duration;
	            new CSSTween(vid.hud.scrub.buffer, [(bufferedPercent * scrubWidth) + 'px'], ['width 0s linear']);
	            playedPercent = vid.currentTime / vid.duration;
	            new CSSTween(vid.hud.scrub.progress, [(playedPercent * scrubWidth) + 'px'], ['width 0s linear']);
	            var totalTime = Video.secondsToTime(vid.duration);
	            vid.hud.scrub.time.innerHTML = Video.secondsToTime(vid.currentTime) + " / " + totalTime;
	        }
	    };
	    Video.secondsToTime = function (seconds) {
	        minutes = Math.floor(seconds / 60);
	        seconds = Math.floor(seconds - (minutes * 60));
	        minutes = minutes < 10 ? "0" + minutes : minutes;
	        seconds = seconds < 10 ? "0" + seconds : seconds;
	        return minutes + ":" + seconds;
	    };
	    window.Video = Video;
	}(window));
	
	(function (window) {
	    Popup.obj;
	    Popup.site;
	
	    function Popup(name, show) {
	        if (Popup.obj !== undefined) hidePopup(Popup.obj);
	        if (Popup.site === undefined) Popup.site = document.getElementById("site");
	        Popup.obj = document.getElementById(name);
	        if (show) {
	            showPopup(Popup.obj);
	        } else {
	            hidePopup(Popup.obj);
	            closeBlocker();
	        }
	    }
	    function showPopup(obj) {
	        document.getElementById('site').style.width = '0%';
	        if (obj) obj.style.display = 'block';
	    }
	    function hidePopup(obj) {
	        document.getElementById('site').style.width = '100%';
	        if (obj) obj.style.display = 'none';
	    }
	    window.Popup = Popup;
	}(window));
	
	(function (window) {
	    function Plus1(domain) {
	        if (!document.getElementById('plus1')) {
	            var div = document.createElement('div');
	            div.setAttribute('id', "plus1");
	            div.innerHTML = "<a id='closeBtn' onclick='closePlus1();'>&times;</a><g:plusone href='" + domain + "' size='medium'></g:plusone>";
	            document.body.appendChild(div);
	            var fileref = document.createElement('script');
	            fileref.setAttribute("type", "text/javascript");
	            fileref.setAttribute("src", 'https://apis.google.com/js/plusone.js');
	            document.getElementsByTagName("head")[0].appendChild(fileref);
	        }
	    }
	    window.Plus1 = Plus1;
	}(window));
	
	(function (window) {
	    function Like(domain) {
	        if (!document.getElementById('like')) {
	            var div = document.createElement('div');
	            div.setAttribute('id', "like");
	            div.innerHTML = "<a id='closeBtn' onclick='closeLike();'>&times;</a><div id='fb-root'></div><fb:like send='true' width='200' show_faces='true'></fb:like>";
	            document.body.appendChild(div);
	            var fileref = document.createElement('script');
	            fileref.setAttribute("type", "text/javascript");
	            fileref.setAttribute("src", 'http://connect.facebook.net/en_US/all.js#xfbml=1');
	            document.getElementsByTagName("head")[0].appendChild(fileref);
	        }
	    }
	    window.Like = Like;
	}(window));
	
	function updateLike(url) {
	    var like = document.getElementById('like').getElementsByTagName('fb:like')[0];
	    like.href = url;
	}
	function closeLike() {
	    Popup('like', false);
	}
	function closePlus1() {
	    Popup('plus1', false);
	}
	function makeLike(domain) {
	    new Like(domain);
	}
	function makePlus1(domain) {
	    new Plus1(domain);
	}
	
	(function (window) {
	    Tooltip.zIndex = 100;
	    Tooltip.borderRadius = '8px';
	    Tooltip.backgroundColor = 'rgba(0,0,0,.7)';
	    Tooltip.textColor = '#CCCCCC';
	    Tooltip.fontFamily = 'Lucida Grande,Lucida,Century Gothic,Arial,sans-serif';
	    Tooltip.fontSize = '10px';
	    Tooltip.padding = '2px 5px';
	    Tooltip.shadow = '1px 3px 3px rgba(0,0,0,0.35)';
	    Tooltip.parent = document.getElementsByTagName('nav')[0];
	    Tooltip.tag = 'a';
	    Tooltip.property = 'alt';
	    Tooltip.showing = false;
	
	    function Tooltip(vars) {
	        for (key in vars) Tooltip[key] = vars[key];
	        Tooltip.build();
	    }
	    Tooltip.build = function () {
	        Tooltip.instance = document.createElement('div');
	        Tooltip.instance.style.opacity = 0;
	        Tooltip.instance.style.position = 'absolute';
	        Tooltip.instance.style.display = 'none';
	        Tooltip.instance.style.zIndex = Tooltip.zIndex;
	        Tooltip.instance.style.borderRadius = Tooltip.borderRadius;
	        Tooltip.instance.style.WebkitBorderRadius = Tooltip.borderRadius;
	        Tooltip.instance.style.boxShadow = Tooltip.shadow;
	        Tooltip.instance.style.WebkitBoxShadow = Tooltip.shadow;
	        Tooltip.instance.style.backgroundColor = Tooltip.backgroundColor;
	        Tooltip.instance.style.color = Tooltip.textColor;
	        Tooltip.instance.style.fontFamily = Tooltip.fontFamily;
	        Tooltip.instance.style.fontSize = Tooltip.fontSize;
	        Tooltip.instance.style.padding = Tooltip.padding;
	        Tooltip.instance.innerHTML = '';
	        d.site.appendChild(Tooltip.instance);
	    };
	    Tooltip.buildArrow = function () {
	        var dnArw = document.createElement('div');
	        dnArw.style.position = 'absolute';
	        dnArw.style.display = 'block';
	        dnArw.style.opacity = 1;
	        dnArw.style.width = 0 + 'px';
	        dnArw.style.height = 0 + 'px';
	        dnArw.style.left = 15 + 'px';
	        dnArw.style.bottom = -6 + 'px';
	        dnArw.style.borderLeft = '6px solid transparent';
	        dnArw.style.borderRight = '6px solid transparent';
	        dnArw.style.borderTop = '6px solid ' + 'rgba(0,0,0,.5)';
	        Tooltip.instance.appendChild(dnArw);
	    };
	    Tooltip.move = function (event) {
	        if (Tooltip.showing) {
	            var width = Util.getStyle(Tooltip.instance, 'width');
	            var height = Util.getStyle(Tooltip.instance, 'height');
	            Tooltip.instance.style.left = event.pageX - 22 + 'px';
	            Tooltip.instance.style.top = event.pageY - height - 15 + 'px';
	        }
	    };
	    Tooltip.text = function (str) {
	        if (str && !Tooltip.showing) {
	            Tooltip.instance.innerHTML = str;
	            Tooltip.buildArrow();
	            Tooltip.show();
	        } else {
	            Tooltip.hide();
	        }
	    };
	    Tooltip.show = function (event) {
	        Tooltip.instance.style.display = 'block';
	        Tooltip.instance.style.opacity = 1;
	        Tooltip.showing = true;
	        document.addEventListener('mousemove', Tooltip.move, false);
	    };
	    Tooltip.hide = function (event) {
	        Tooltip.instance.style.display = 'none';
	        Tooltip.instance.style.opacity = 0;
	        Tooltip.showing = false;
	        document.removeEventListener('mousemove', Tooltip.move, false);
	    };
	    window.Tooltip = Tooltip;
	}(window));
	
	(function (window) {
	    Site.curImgNum = 1;
	    Site.curSection = '';
	    Site.curPath = '';
	    Site.blocker = false;
	    Site.rotateInit = true;
	
	    function Site() {
	        if (POD || PAD) {
	            window.addEventListener('orientationchange', Site.rotate, false);
	            window.addEventListener('scroll', Site.scroll, false);
	        } else {
	            window.addEventListener('resize', Site.resize, false);
	            window.addEventListener('keydown', Site.keydown, false);
	            window.ondragstart = function () {
	                return false;
	            }
	        }
	        Site.getSiteObjects();
	        Site.load();
	    }
	    Site.load = function () {
	        if ('gary_land_logo-01.jpg' != '' && Address.getPath() == '' && Address.getQuery() === '') {
	            Site.state = INTRO;
	            d.introLogo.style.opacity = 0;
	            d.introLogo.src = d.introLogo.getAttribute('data-src');
	            d.introLogo.addEventListener('load', Site.fadeInIntro, false);
	        } else {
	            if (d.introLogo) d.introLogo.style.display = 'none';
	            Site.loadMainSite();
	        }
	    };
	    Site.fadeInIntro = function () {
	        d.introLogo.style.display = 'block';
	        d.introLogo.style.left = ((window.innerWidth - d.introLogo.width) * 0.5) + 'px';
	        d.introLogo.style.top = ((window.innerHeight - d.introLogo.height) * 0.5) + 'px';
	        new CSSTween(d.introLogo, [1], ['opacity .85s cubic'], Site.fadeOutIntro, false);
	    };
	    Site.fadeOutIntro = function () {
	        setTimeout(function () {
	            new CSSTween(d.introLogo, [0], ['opacity .7s cubic'], function () {
	                d.introLogo.style.display = 'none';
	                Site.loadMainSite();
	            }, false);
	        }, 2000);
	    };
	    Site.loadMainSite = function () {
	        Site.state = HOME;
	        Site.menu = new Menu();
	        Address.addEventListener('addressEvent', Site.goto, false);
	        new CSSTween(d.site, [1], ['opacity .8s cubic']);
	        if (POD) d.site.style.backgroundColor = '#ffffff';
	        setTimeout(Site.goto, 10);
	        if (POD) {
	            Site.touchNav = new TouchNav();
	            Site.hideAb();
	        } else if (PAD) {
	            Site.touchNav = new TouchNav();
	            Site.nav = Site.site.getElementsByTagName('nav')[0];
	            Site.navbar = new Navbar();
	            Site.hideAb();
	        } else {
	            Site.cursor = new Cursor();
	            Site.nav = Site.site.getElementsByTagName('nav')[0];
	            Site.navbar = new Navbar();
	            Site.footer = new Footer();
	            Site.tooltip = new Tooltip();
	        }
	        setTimeout(Site.resize, 2);
	    };
	    Site.startSlideshow = function () {
	        if (Site.curMediaItem) Site.curMediaItem.style.backgroundColor = '#ffffff';
	        if (Site.oldMediaItem) {
	            d.mediaView.style.backgroundColor = '#ffffff';
	            if (Site.state != SLIDESHOW) {
	                Site.oldMediaItem.style.opacity = 0;
	                Site.oldMediaItem.style.display = 'none';
	            }
	        }
	        Site.curImgNum = 1;
	        Site.state = SLIDESHOW;
	        Site.slideInterval = setInterval(Site.next, SLIDE_INTERVAL);
	        if (Site.thumbs) Thumbnails.hide();
	        Site.goto();
	        if (POD || PAD) Menu.close();
	    };
	    Site.hideAb = function () {
	        if (Site.rotateInit) {
	            window.scrollTo(0, 1);
	        }
	        setTimeout(function () {
	            Site.resizeMediaView(STAGE_WIDTH, STAGE_HEIGHT, Site.getMediaViewLeft(), 50);
	        }, 50);
	        Site.rotateInit = false;
	    };
	    Site.rotate = function () {
	        Site.rotateInit = true;
	        Site.hideAb();
	        setTimeout(Site.resize, 50);
	        setTimeout(Site.resize, 500);
	        setTimeout(Site.resize, 1000);
	    };
	    Site.scroll = function () {
	        resizeBlocker();
	    };
	    Site.resize = function () {
	        if (('' != '' && Address.getPath() == '') && 'fit' == 'fillSite') {
	            STAGE_WIDTH = window.innerWidth, STAGE_HEIGHT = window.innerHeight;
	        } else {
	            STAGE_WIDTH = Site.getWidth();
	            STAGE_HEIGHT = Site.getHeight();
	        }
	        if (Site.state == INTRO) {
	            new CSSTween(d.introLogo, [((window.innerWidth - d.introLogo.width) * 0.5) + 'px', ((window.innerHeight - d.introLogo.height) * 0.5) + 'px'], ['left 0s linear', 'top 0s linear']);
	        } else {
	            Site.resizeMediaView(STAGE_WIDTH, STAGE_HEIGHT, Site.getMediaViewLeft(), 50);
	            Menu.resize();
	        }
	        if ('left' == 'center' && !POD && !PAD) {
	            var logoWidth = Util.getStyle(d.logo, 'width');
	            d.logo.style.left = ((window.innerWidth - logoWidth) * 0.5) + 'px';
	        }
	        if (d.logo && Menu.state !== 'closed') new CSSTween(d.logo, [1], ['opacity .7s cubic']);
	        if ('top' == 'center' && !POD && !PAD) {
	            var logoHeight = Util.getStyle(d.logo, 'height');
	            d.logo.style.top = ((window.innerHeight - logoHeight) * 0.5) + 'px';
	        }
	        if (Site.curMediaItem) {
	            Site.resizeMediaItem(Site.curMediaItem);
	            Caption.resize();
	        }
	        if (Site.thumbs) Thumbnails.resize();
	        if (Site.share) Share.resize();
	        if (Site.navbar) {
	            Navbar.resize();
	            setTimeout(Navbar.resize, 1000);
	        }
	        if (Site.touchNav && Address.getPath() != '') TouchNav.checkVisible();
	        Scroll.resize();
	        Pass.align();
	        if (Site.footer) Footer.resize();
	    };
	    Site.getMediaViewLeft = function () {
	        if (PAD || POD) {
	            return 0;
	        } else {
	            switch ('left') {
	                case 'left':
	                    return 60 + 275 - 34;
	                    break;
	                case 'right':
	                    return 60;
	                    break;
	            }
	        }
	    };
	    Site.resizeMediaView = function (stageWidth, stageHeight, left, top) {
	        var width = stageWidth,
	            height = stageHeight;
	        if (PAD || ('' != '' && Address.getPath() == '' && 'fit' == 'fillSite')) {
	            top = 0, left = 0;
	        } else if (POD) {
	            top = window.pageYOffset, left = 0;
	        }
	        d.mediaView.style.left = left + 'px';
	        d.mediaView.style.top = top + 'px';
	        d.mediaView.style.width = width + 'px';
	        d.mediaView.style.height = height + 'px';
	    };
	    Site.resizeMediaItem = function (mediaItem) {
	        new CSSTween(mediaItem, [STAGE_WIDTH + 'px', STAGE_HEIGHT + 'px'], ['width 0s linear', 'height 0s linear']);
	        switch (mediaItem.getAttribute('data-type')) {
	            case IMAGE:
	                ImgLoader.resize(mediaItem);
	                break;
	            case VIDEO:
	                ImgLoader.resize(mediaItem);
	                if (mediaItem.vidLoaded) Video.resize(Site.getMediaAsset(mediaItem, VIDEO));
	                break;
	            case HTML:
	                Page.resize(mediaItem);
	                break;
	            case CONTACT:
	                if (POD) {
	                    Share.setContactTouchEvents();
	                    Page.resize(mediaItem);
	                } else {
	                    setTimeout(function () {
	                        var contact = Site.getMediaAsset(mediaItem, 'contactForm');
	                        var title = Site.getMediaAsset(mediaItem, 'contactFormTitle');
	                        var titleOffset;
	                        if (title) {
	                            titleOffset = title.innerHTML === '' ? -44 : -22;
	                            title.style.top = -(Util.getStyle(title, 'height') - titleOffset) + 'px';
	                        } else {
	                            titleOffset = -44;
	                        }
	                        contact.style.left = (STAGE_WIDTH - Util.getStyle(contact, 'width')) * 0.5 - (Util.getStyle(contact, 'width') * 0.1) + 'px';
	                        contact.style.top = (STAGE_HEIGHT - Util.getStyle(contact, 'height')) * 0.5 + titleOffset + 'px';
	                        var rgb = Util.hexToRGB('#FFFFFF');
	                        Site.getMediaAsset(mediaItem, 'contactFormFields').style.borderLeft = "1px solid rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + .5 + ")";
	                        var fields = document.contact.getElementsByTagName('input');
	                        var i = fields.length;
	                        while (i--) {
	                            var focus = Site.contactfocus,
	                                blur;
	                            if (fields[i].type === 'button') {
	                                focus = Site.submitfocus;
	                                blur = Site.submitblur;
	                            } else {
	                                focus = Site.contactfocus;
	                                blur = Site.contactblur;
	                            }
	                            blur.call(fields[i]);
	                            fields[i].addEventListener('focus', focus, false);
	                            fields[i].addEventListener('blur', blur, false);
	                        }
	                        var textarea = document.contact.getElementsByTagName('textarea');
	                        if (textarea) {
	                            Site.contactblur.call(textarea[0]);
	                            textarea[0].addEventListener('focus', Site.contactfocus, false);
	                            textarea[0].addEventListener('blur', Site.contactblur, false);
	                        }
	                    }, 10);
	                }
	                break;
	        }
	    };
	    Site.contactfocus = function () {
	        var rgb1 = Util.hexToRGB('#000000');
	        this.style.backgroundColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + 0.1 + ")";
	        this.style.borderColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + .6 + ")";
	        var rgb2 = Util.hexToRGB('#FFFFFF');
	        this.style.color = "rgba(" + rgb2.r + "," + rgb2.g + "," + rgb2.b + "," + 1 + ")";
	    };
	    Site.contactblur = function () {
	        var rgb1 = Util.hexToRGB('#000000');
	        this.style.backgroundColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + .1 + ")";
	        this.style.borderColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + .3 + ")";
	        var rgb2 = Util.hexToRGB('#FFFFFF');
	        this.style.color = "rgba(" + rgb2.r + "," + rgb2.g + "," + rgb2.b + "," + 1 + ")";
	    };
	    Site.submitfocus = function () {
	        var rgb1 = Util.hexToRGB('#000000');
	        this.style.backgroundColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + .1 + ")";
	        this.style.borderColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + 0 + ")";
	        var rgb2 = Util.hexToRGB('#FFFFFF');
	        this.style.color = "rgba(" + rgb2.r + "," + rgb2.g + "," + rgb2.b + "," + 1 + ")";
	    };
	    Site.submitblur = function () {
	        var rgb1 = Util.hexToRGB('#000000');
	        this.style.backgroundColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + 1 + ")";
	        this.style.borderColor = "rgba(" + rgb1.r + "," + rgb1.g + "," + rgb1.b + "," + 0 + ")";
	        var rgb2 = Util.hexToRGB('#ffffff');
	        this.style.color = "rgba(" + rgb2.r + "," + rgb2.g + "," + rgb2.b + "," + 1 + ")";
	    };
	    Site.getMediaAsset = function (mediaItem, clss) {
	        var asset = mediaItem.getElementsByTagName('*');
	        var i = asset.length;
	        while (i--) if (Util.findClass(asset[i], clss)) return asset[i];
	    };
	    Site.next = function () {
	        Transition.setDir('left');
	        Site.curImgNum = Site.curImgNum < Site.curMediaItemsInSection ? Site.curImgNum + 1 : 1;
	        if (Address.getPath() == '') {
	            Site.goto();
	        } else {
	            Address.setPath(Site.curPath + "/" + Site.curImgNum);
	        }
	    };
	    Site.prev = function () {
	        Transition.setDir('right');
	        Site.curImgNum = Site.curImgNum - 1 > 0 ? Site.curImgNum - 1 : Site.curMediaItemsInSection;
	        Address.setPath(Site.curPath + "/" + Site.curImgNum);
	    };
	    Site.keydown = function (e) {
	        switch (e.which) {
	            case 37:
	                Site.prev();
	                break;
	            case 39:
	                Site.next();
	                break;
	            case 32:
	                Video.playPause();
	                break;
	            case 38:
	                if (!POD && !PAD) {
	                    Address.setPath(Site.curPath + "/" + Site.curImgNum + "/thumbs/");
	                }
	                break;
	            case 13:
	                if (Site.curMode === 'thumbs') {
	                    Address.setPath(Site.curPath + "/" + Site.curImgNum);
	                }
	                break;
	            case 27:
	                Address.setPath(Site.curPath + "/" + Site.curImgNum);
	                Caption.off();
	                Pass.hide();
	                closePlus1();
	                closeLike();
	                break;
	            case 70:
	                if (!POD && !PAD && Site.curMode !== 'email' && Site.state != CONTACT && !Pass.showing) {
	                    Fullscreen.toggle();
	                }
	                break;
	        }
	    };
	    Site.getWidth = function () {
	        if (PAD || POD) {
	            return window.innerWidth;
	        } else {
	            if ('left' == 'left') {
	                return (window.innerWidth - (60 + 25 + Menu.getWidth() - 34));
	            } else {
	                return (window.innerWidth - (60 + 25 + Menu.getWidth() + 34));
	            }
	        }
	    };
	    Site.getHeight = function () {
	        if (PAD || POD) {
	            return window.innerHeight;
	        } else {
	            return (window.innerHeight - (50 + 100));
	        }
	    };
	    Site.getCurSection = function () {
	        Site.getCurSectionPath();
	        var section = SLIDESHOW;
	        if (Site.curSection[1]) {
	            section = Site.curSection[0] + '.' + Site.curSection[1];
	        } else if (Site.curSection[0]) {
	            section = Site.curSection[0];
	        }
	        return document.getElementById(section);
	    };
	    Site.getMediaItemsInSection = function () {
	        var oldPath = Site.curPath;
	        var section = Site.getCurSection();
	        Pass.checkLock(section);
	        var newPath = Site.curPath;
	        Site.newSection = false;
	        if (oldPath != newPath && Site.curPath != '') {
	            Site.newSection = true;
	            Site.numItemsInSection = 0;
	            var divs = section.getElementsByTagName('article');
	            var mediaItems = new Array();
	            for (var i = 0; i < divs.length; i++) {
	                if (Util.findClass(divs[i], 'mediaItem')) {
	                    divs[i].index = i;
	                    Site.numItemsInSection++;
	                    if (!divs[i].loading) divs[i].loading = false;
	                    if (!divs[i].loaded) divs[i].loaded = false;
	                    if (divs[i].getAttribute('data-type') == HTML || divs[i].getAttribute('data-type') == '' || divs[i].getAttribute('data-type') == 'contactForm') divs[i].loaded = true;
	                    if (divs[i].getElementsByTagName('cite')[0]) {
	                        var captRgb = Util.hexToRGB('#000000');
	                        var cap = divs[i].getElementsByTagName('cite')[0];
	                        cap.style.opacity = 0;
	                        cap.style.backgroundColor = "rgba(" + captRgb.r + "," + captRgb.g + "," + captRgb.b + "," + 0.9 + ")";
	                    }
	                    mediaItems.push(divs[i]);
	                }
	            }
	            Site.curMediaItemsInSection = mediaItems.length;
	            Site.curMediaItems = mediaItems;
	        }
	        return Site.curMediaItems;
	    };
	    Site.sectionExists = function (name) {
	        return document.getElementById(name) ? true : false;
	    };
	    Site.getCurSectionPath = function () {
	        Site.curSection = [];
	        Site.curPath = '';
	        var path = Address.getPathNames();
	        var sectionLimit;
	        if (path.length === 1 && path[0] === '') { /* root uri */
	            Site.curSection[0] = SLIDESHOW;
	            Site.curSection[1] = null;
	            Site.curPath = SLIDESHOW;
	            Site.curMode = '';
	        } else if (path[path.length - 1] > 0) { /* this is an asset - maybe */
	            Site.curImgNum = Number(path[path.length - 1]);
	            Site.curMode = '';
	            sectionLimit = path.length - 1;
	        } else if (Site.sectionExists(path[path.length - 2]) && (path[path.length - 1] === 'thumbs')) { /* section with thumbs overlay */
	            Site.curImgNum = 0;
	            Site.curMode = 'thumbs';
	            sectionLimit = path.length - 1;
	        } else if (Site.sectionExists(path[path.length - 3] + '.' + path[path.length - 2]) && (path[path.length - 1] === 'thumbs')) { /* sub section with thumbs overlay */
	            Site.curImgNum = 0;
	            Site.curMode = 'thumbs';
	            sectionLimit = path.length - 1;
	        } else if (path[path.length - 2] > 0 && (path[path.length - 1] === 'thumbs' || path[path.length - 1] === 'caption' || path[path.length - 1] === 'email')) { /* asset with thumbs overlay */
	            Site.curImgNum = Number(path[path.length - 2]);
	            Site.curMode = path[path.length - 1];
	            sectionLimit = path.length - 2;
	        } else if (path[path.length - 1] === 'thumbs') { /* thumbs first behavior,with no asset */
	            Site.curImgNum = 0;
	            Site.curMode = 'thumbs';
	            sectionLimit = path.length - 1;
	        } else { /* no asset or thumbs state - 404 most likely */
	            Site.curImgNum = 0;
	            Site.curMode = '';
	            sectionLimit = path.length;
	        }
	        for (var i = 0; i < sectionLimit; i += 1) {
	            Site.curSection.push(path[i]);
	            Site.curPath += path[i];
	            if (i < sectionLimit - 1) {
	                Site.curPath += "/";
	            }
	        }
	    };
	    Site.getSiteObjects = function () {
	        var o = document.getElementsByTagName('*');
	        var i = o.length;
	        while (i--) o[i].id ? Site[o[i].id] = o[i] : Site[o[i].tagName] = o[i];
	    };
	    Site.checkSlideshowStatus = function () {
	        if ('' != '' && Address.getPath() == '') {
	            if (Site.curMediaItem && Site.curMediaItem.getAttribute('data-type') == VIDEO && !POD && !PAD) {
	                clearInterval(Site.slideInterval);
	                Site.slideInterval = null;
	            } else if (!Site.slideInterval) {
	                Menu.curBtn = undefined;
	                setTimeout(Site.startSlideshow, 10);
	            }
	        } else if ('' === '' && Address.getPath() == '') {
	            Site.gotoFirstSection();
	        } else if (Address.getPath() != '') {
	            clearInterval(Site.slideInterval);
	            Site.slideInterval = null;
	        }
	    };
	    Site.gotoFirstSection = function () {
	        var firstSection = Site.getFirstSection();
	        if (firstSection) {
	            var dataThumb = firstSection.getAttribute('data-thumb');
	            var thmDataObj = JSON.parse(dataThumb);
	            if (dataThumb && thmDataObj.defaultOn && thmDataObj.type === 'fill' && !POD) {
	                if (Site.curMediaItem) new CSSTween(Site.curMediaItem, [0], ['opacity .15s cubic']);
	                Address.setTitle(firstSection.getAttribute('data-label'));
	                Address.setPath(firstSection.getAttribute('href') + "thumbs/");
	            } else {
	                Address.setPath(firstSection.getAttribute('href') + "1/");
	            }
	        }
	    };
	    Site.getFirstSection = function () {
	        return d.menuText.getElementsByTagName('a')[0];
	    };
	    Site.checkSectionLoaded = function () {
	        var section = Site.getCurSection();
	        var divs = section.getElementsByTagName('article');
	        var loaded = new Array();
	        var mediaItems = new Array();
	        for (var i = 0; i < divs.length; i++) {
	            if (Util.findClass(divs[i], 'mediaItem')) {
	                mediaItems.push(divs[i]);
	                if (divs[i].loaded || divs[i].loading) {
	                    loaded.push(divs[i]);
	                }
	            }
	        }
	        if (loaded.length >= mediaItems.length) {
	            return true;
	        } else {
	            return false;
	        }
	    };
	    Site.loadMediaItem = function (i) {
	        var mediaItems = Site.curMediaItems;
	        var curMediaItem = mediaItems[i];
	        if (i < mediaItems.length) {
	            if (!Site.checkSectionLoaded() && !curMediaItem.loading && !curMediaItem.loaded && (curMediaItem.getAttribute('data-type') == IMAGE || curMediaItem.getAttribute('data-type') == VIDEO)) {
	                ImgLoader.load(curMediaItem);
	            } else if (!Site.checkSectionLoaded()) {
	                i < mediaItems.length - 1 ? i++ : i = 0;
	                setTimeout(function () {
	                    Site.loadMediaItem(i)
	                }, 600);
	            }
	        }
	    };
	    Site.goto = function () {
	        Site.getMediaItemsInSection();
	        var section = Site.getCurSection();
	        if (!section.locked) {
	            Site.address();
	            Pass.hide();
	        } else {
	            Pass.show(section);
	            Site.checkSlideshowStatus();
	        }
	        Menu.select();
	    };
	    Site.address = function () {
	        if (document.getElementById('like') && Site.curPath && Site.curImgNum) {
	            updateLike('http://garylandphotography.com/' + Site.curPath + '/' + Site.curImgNum + '/');
	        }
	        if (Site.curMediaItem) {
	            Site.oldMediaItem = Site.curMediaItem;
	        }
	        Video.pauseCur();
	        Site.curMediaItem = Site.getNewMediaItem();
	        Site.checkSlideshowStatus();
	        if (Site.curMediaItem) {
	            var mediaItem = Site.curMediaItem;
	            mediaItem.style.display = 'block';
	            if (Address.getPath() == '' && 'fit' != 'fit') {
	                mediaItem.style.backgroundColor = '#ffffff';
	                d.mediaView.style.backgroundColor = '#ffffff';
	            } else {
	                Site.state = mediaItem.getAttribute('data-type');
	                mediaItem.style.backgroundColor = '#ffffff';
	                d.mediaView.style.backgroundColor = '#ffffff';
	            }
	            Site.setBrowserTitle(mediaItem);
	            Site.resize();
	            Site.loadMediaItem(mediaItem.index);
	            if (mediaItem.loaded) Video.autoLoad(mediaItem);
	            mediaItem.style.zIndex = 1;
	            if (PAD || POD) {
	                if (Site.state != SLIDESHOW) TouchNav.checkVisible();
	                TouchNav.addListeners(mediaItem);
	                if (Site.state == HTML) Page.linkTouchEvents(mediaItem);
	                if (Site.newSection || Address.getPath() == '') {
	                    new Transition(mediaItem, {
	                        old: Site.oldMediaItem,
	                        type: 'fade'
	                    });
	                } else if (Site.oldMediaItem) {
	                    new Transition(mediaItem, {
	                        old: Site.oldMediaItem,
	                        type: 'fade'
	                    });
	                } else {
	                    new Transition(mediaItem, {
	                        type: 'fade'
	                    });
	                }
	            } else {
	                new Transition(mediaItem, {
	                    old: Site.oldMediaItem,
	                    onComplete: Site.transitionComplete
	                });
	            }
	        }
	        if (!POD) {
	            Navbar.setCount();
	            Navbar.check();
	        }
	        Site.checkMode();
	    };
	    Site.transitionComplete = function () {};
	    Site.getNewMediaItem = function () {
	        var o = document.getElementById('mediaView').getElementsByTagName('article');
	        var mediaItem = undefined;
	        for (var i in o) {
	            if (Util.findClass(o[i], 'mediaItem')) {
	                switch (o[i].id == '/' + Site.curPath + '/' + Site.curImgNum + '/') {
	                    case true:
	                        mediaItem = o[i];
	                        break;
	                    default:
	                        if ((POD || PAD) && Site.state != SLIDESHOW) {
	                            o[i].style.display = 'none';
	                        }
	                        break;
	                }
	            }
	        }
	        return mediaItem;
	    };
	    Site.setBrowserTitle = function (mediaItem) {
	        if (mediaItem && mediaItem.getAttribute('data-label') && Site.curSection[0] != SLIDESHOW && Site.curSection[0] != undefined && 'true' == 'false') {
	            document.title = mediaItem.getAttribute('data-label');
	        } else {
	            document.title = decodeURIComponent("Gary Land Photography");
	        }
	    };
	    Site.checkMode = function () {
	        switch (Site.curMode) {
	            case 'thumbs':
	                Site.resize();
	                if (!Site.thumbs && !POD) new Thumbnails();
	                if (Site.thumbs && !POD) Thumbnails.show();
	                break;
	            case 'email':
	                if (!Site.share) new Share();
	                if (!Share.open) Share.show();
	                break;
	            case 'caption':
	                Caption.on();
	                break;
	            default:
	                if (Site.thumbs && Thumbnails.open) Thumbnails.hide();
	                if (Share.open) Share.hide();
	                if (Caption.state === false) Caption.off();
	                break;
	        }
	        Caption.check();
	    };
	    window.Site = Site;
	}(window));
	
	if (typeof document.onreadystatechange === 'object') {
	    document.onreadystatechange = function () {
	        if (document.readyState === 'complete') {
	            new Site();
	        }
	    };
	} else {
	    window.onload = function () {
	        new Site();
	    };
	}
} catch (err) {
    console.log(err)
};